I would like to know whether it´s possible to add or remove specified widgets on runtime.

form example i press any tool on my toolbar and add widget to sidebar . press again to remove widget.

Adding widgets is not difficult. you can use topic.publish('viewer/loadWidget')

Removing them can be more problematic - depends on the widget and whether it properly cleans up after itself. ;)

I have accomplished the same thing by loading all the widgets at the start and showing/hiding the desired widget using css. Roughly something like this :

domStyle.set(dom.byId('find_parent'), 'display', 'block');

domStyle.set(dom.byId('find_parent'), 'display', 'none');

In this case find_parent is the id for the titlePane widget that contains the CMV Find widget. Note that I don't usually use dom.byId for this. It is a simple example of one option.

Would this approach work for you?

thanks dear tmcgee. this work for me.

        require(["dojo/dom-style", "dojo/dom", "dojo/on", "dojo/domReady!"],
        function (style, dom, on) {
            on(dom.byId("btnidentify"), "click", function () {
                var p_identify = dom.byId("identify_parent");
                if (p_identify.style.display === 'none') {
                    p_identify.style.display = 'block';
                } else {
                    p_identify.style.display = 'none';


Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.