Created
June 24, 2011 15:07
-
-
Save PEM-FR/1044970 to your computer and use it in GitHub Desktop.
Find and select the tab of a TabContainer parent of currentWidget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this, is the tabContainer | |
findAndSelectTab : function(currentWidget){ | |
var tabContainerId = this.get('id'); | |
var parent = null; | |
var tab = null; | |
if(undefined != currentWidget.getParent | |
&& undefined != typeof(currentWidget.getParent())){ | |
parent = currentWidget.getParent(); | |
}else{ | |
parent = dijit.getEnclosingWidget(currentWidget.domNode); | |
} | |
if(tabContainerId == parent.getParent().get('id')){ tab = parent; } | |
while(undefined != parent | |
&& tabContainerId != parent.get('id')){ | |
if(undefined != currentWidget.getParent | |
&& undefined != typeof(parent.getParent())){ | |
parent = parent.getParent(); | |
}else{ | |
parent = dijit.getEnclosingWidget(parent.domNode); | |
} | |
if(tabContainerId == parent.getParent().get('id')){ | |
tab = parent; | |
} | |
} | |
this.selectChild(tab); | |
}, | |
getWidgetParent : function(someWidget){ | |
var myParent = null; | |
if(undefined != someWidget.getParent | |
&& undefined != typeof(someWidget.getParent())){ | |
myParent = someWidget.getParent(); | |
}else{ | |
myParent = dijit.getEnclosingWidget(someWidget.domNode); | |
} | |
return myParent; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment