Skip to content Skip to sidebar Skip to footer

How To Remove Dojo Widgets By Registered By Id, But Not Referenced In Any Dom Node

Context: I am working on an application which has now been converted to a single page application. There are many widgets in the application and a lot of them have been assigned id

Solution 1:

At face value, you are looking for dijit/registry.findWidgets:

require([ 'dojo/_base/array', 'dojo/dom-construct', 'dijit/registry' ], function (arrayUtil, domConstruct, registry) {
    arrayUtil.forEach(registry.findWidgets(this.someNode), function (widget) {
        widget.destroyRecursive();
    });
    domConstruct.empty(this.someNode);
});

If you're generally dealing with an area of free-form content that often needs to be cleared or refreshed, you might want to look at dijit/layout/ContentPane.

Post a Comment for "How To Remove Dojo Widgets By Registered By Id, But Not Referenced In Any Dom Node"