Skip to content

Instantly share code, notes, and snippets.

@xenophy
Created October 8, 2012 13:59
Show Gist options
  • Save xenophy/3852681 to your computer and use it in GitHub Desktop.
Save xenophy/3852681 to your computer and use it in GitHub Desktop.
Active tab panel decision by the component query for Ext JS 4
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