Ayyoudy
Ayyoudy

Reputation: 3721

Dojo query on specific ContentPane in TabContainer

I have a TabContainer with different tabs (ContentPanes). I am loading each type dynamically when the user selects something from a tree. I would like to be able to run a certain JS function on the newly loaded ContentPane/Tab. So something in this form:

dojo.forEach(
    dojo.query("select"),
        function(selectTag) {
            selectTag.disabled = true;
    }
);

However, I only want to process this on the newly loaded ContentPane/Tab... so let's say given a ContentPane/Tab Dojo Object, how do I do a forEach/query on its content only?

Thanks

Upvotes: 1

Views: 690

Answers (1)

Frode
Frode

Reputation: 5710

You can give dojo.query a second argument telling it in which DOM node to start looking. So if you have a ContentPane with id "fooTab", you can do:

dojo.forEach(dojo.query("select", "fooTab"), 
    function(selectTag) {
        ....
    }
);

Now, technically, "fooTab" is the "dijit ID", but the dijit's/ContentPane's outermost DOM node will also have an id "fooTab". Perhaps not the kosher way, but it works.

Upvotes: 2

Related Questions