Search code examples
onclickdojodom-events

Dijit TabContainer Events - onFocus


I have a Tab Container and I want to execute some js when I click on a tab's title bar.

I can't seem to figure out how to add an event to that.


EDIT:

It looks like I'll be using onFocus, but I'm still having trouble finding the proper syntax.


EDIT: Found onFocus and onBlur, but still having trouble getting it to work.


Solution

  • You need to connect to the _transition event.

    var tabs = dijit.byId("tabs");
    dojo.connect(tabs,"_transition", function(newPage, oldPage){
        console.log("I was showing: ", oldPage || "nothing");
        console.log("I am now showing: ", newPage);
    });
    

    Where "tabs" is your TabContainer.