Skip to content

Does dojo TabContainer have an event thats triggered when changing tabs?

does DOJO TabContainer have an event thats triggered when changing tabs?

I imagine it would but I couldn’t find anything about it in the documentation. 🙁

SOLVED: It looks like I found a solution here:

Dijit TabContainer Events – onFocus

not the most searchable topic title :/

Answer

Connect aspect.after to TabContainer’s selectChild method:

var tabContainer1 = registry.byId("tabContainer1");

aspect.after(tabContainer1, "selectChild", function() {
    console.log("tab changed");        
});

Or if you are interested in a particular tab, connect to its ContentPane’s _onShow:

var contentPane1 = registry.byId("contentPane1");

aspect.after(contentPane1, "_onShow", function() {
    console.log("[first] tab selected");        
});

See it in action at jsFiddle: http://jsfiddle.net/phusick/Mdh4w/