Created
October 8, 2012 13:59
-
-
Save xenophy/3852681 to your computer and use it in GitHub Desktop.
Active tab panel decision by the component query for Ext JS 4
This file contains hidden or 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
Ext.onReady(function() { | |
Ext.ComponentQuery.pseudos.isActive = function(items) { | |
var i = 0, l = items.length, c, result = []; | |
for(; i < l; i++) { | |
if((c = items[i]).tab.active) { | |
result.push(c); | |
} | |
} | |
return result; | |
}; | |
Ext.widget('tabpanel', { | |
width: 500, | |
height: 300, | |
renderTo: Ext.getBody(), | |
items: [{ | |
title: 'tabA' | |
}, { | |
title: 'tabB' | |
}, { | |
title: 'tabC' | |
}], | |
buttons: [{ | |
text: 'execute', | |
handler: function() { | |
var q = 'tabpanel panel:isActive'; | |
var ret = Ext.ComponentQuery.query(q); | |
console.log(ret); | |
} | |
}] | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment