Get id of selected tab in TabContainer

var tabs = dijit.byId("#{id:djContentPane1}");

dojo.connect(tabs,"selectChild",function(child){
    console.log("selected Tab: ", child.id);
});





The code can be tested in the Extension Library.  Paste the code above into the OnClientLoad event of /Core_DojoLayout.xsp.
Then open the page in Firefox (Firebug enabled) and click on the tabs in the TabContainer example.

The output should be sth. like this

selected Tab: view:_id1:cc4cconeuilayout:OneUIMainAreaCallback:djContentPane1:djTabPane2
selected Tab: view:_id1:cc4cconeuilayout:OneUIMainAreaCallback:djContentPane1:djTabPane1

JavaScript (Client)
Ulrich Krause
November 30, 2011 1:36 AM
Rating
243

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...