如何使用 dojo 选项卡测试选项卡是否处于活动状态
如何使用 dojo 选项卡容器测试选项卡是否处于活动状态? (在 JQuery 中这很简单......你可以使用这样的东西
if($("#accordion").accordion('option', 'active') == mytabNumber){
对于 dojo's,dijit.layout.TabContainer 必须有一种类似的方法来做到这一点,而不必编写 Litener 函数和所有爵士乐。
也许像......
if( dojo.byId("tab2"), {selected:true} ){
提前致谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将选项卡的小部件与选项卡容器的
selectedChildWidget
属性进行比较,即:dijit.byId('tabContainer').selectedChildWidget == dijit.byId('tab2')
You can compare the widget for the tab with the tab container's
selectedChildWidget
property, i.e.:dijit.byId('tabContainer').selectedChildWidget == dijit.byId('tab2')
如果您已经引用了该选项卡,则只需检查其“selected”属性即可查看它是否已被选中,而不管它位于哪个容器中。
我在 http://jsfiddle.net/brianarn/ws28T/
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.
I've created a more detailed example at http://jsfiddle.net/brianarn/ws28T/
下面是更完整的代码答案,给出了 Dojo 1.8 的周围代码:
Here's more complete code answer that gives the surrounding code for Dojo 1.8: