javascript - How do I "get" the ID for a "clicked" tab in a dijit.layout.tabcontainer? -
I can not find a clearly defined solution for this. Most are incomplete snippets.
Here is a simple sample DoSomething () comment:
& lt; Head & gt; & Lt; Style type = "text / css" & gt; Body, html {font-family: helvetica, ariel, non-serif; Font-size: 90%; } & Lt; / Style & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dijit/themes/claro/claro.css" /> & Lt; Script src = "http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" djConfig = "parseOnLoad: true" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Dojo.require ("dijit.layout.TabContainer"); Dojo.require ("dijit.layout.ContentPane"); The function doSomething () {// click here which identifies the clicked tab and displays the ID in the warning alert below ("Hello World!"); } & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body class = "claro" & gt; & Lt; Div id = "mainTab" dojoType = "dijit.layout.TabContainer" style = "width: 400px; height: 100px;" OnClick = "DoSomething ();" & Gt; & Lt; Div id = "tab1" dojoType = "dijit.layout.ContentPane" title = "my first tab" selected = "true" & gt; The website and all around ... & lt; / Div & gt; & Lt; Div id = "tab2" dojoType = "dijit.layout.ContentPane" title = "My second tab" & gt; Home and all around - Second ... & lt; / Div & gt; & Lt; Div id = "tab3" dojoType = "dijit.layout.ContentPane" title = "My last tab" & gt; Website and all around - Final ... & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt;
I believe dijit .byId ('MainTab'). SelectedChildWidget
You should reference a widget in the selected tab (such as one of your content pages).
Comments
Post a Comment