admin管理员组文章数量:1316974
How do you test whether a tab is active or not with a dojo tab container? (In JQuery this is simple... you can use something like this
if($("#accordion").accordion('option', 'active') == mytabNumber){
With dojo's, dijit.layout.TabContainer there must be a similiar way to do it without having to write a litener function and all that jazz.
perhaps something like...
if( dojo.byId("tab2"), {selected:true} ){
Thanks in advance!
How do you test whether a tab is active or not with a dojo tab container? (In JQuery this is simple... you can use something like this
if($("#accordion").accordion('option', 'active') == mytabNumber){
With dojo's, dijit.layout.TabContainer there must be a similiar way to do it without having to write a litener function and all that jazz.
perhaps something like...
if( dojo.byId("tab2"), {selected:true} ){
Thanks in advance!
Share Improve this question asked Jun 29, 2011 at 21:24 lancelance 531 silver badge9 bronze badges3 Answers
Reset to default 6You can pare the widget for the tab with the tab container's selectedChildWidget
property, i.e.:
dijit.byId('tabContainer').selectedChildWidget == dijit.byId('tab2')
If you have a reference to the tab already, you can simply just check its 'selected' property to see if it's selected, regardless of the container it is in.
var tab2 = dijit.byId('tab2');
if (tab2.get('selected')) { /* do stuff */ }
I've created a more detailed example at http://jsfiddle/brianarn/ws28T/
Here's more plete code answer that gives the surrounding code for Dojo 1.8:
require(["dijit/registry", "dojo/ready", "dojo/domReady!"], function (registry, ready) {
ready(function () { //wait till dom is parsed into dijits
if (dijit.byId('tabContainer').selectedChildWidget == dijit.byId('tab2'))
alert('Yes, we found it!');
});
});
本文标签: javascriptHow do you test whether a tab is active with dojo tabsStack Overflow
版权声明:本文标题:javascript - How do you test whether a tab is active with dojo tabs - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742021283a2414722.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论