Skip to content

Instantly share code, notes, and snippets.

@PEM-FR
Created June 24, 2011 15:07
Show Gist options
  • Save PEM-FR/1044970 to your computer and use it in GitHub Desktop.
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, 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