Reputation: 355
In my app, I have two pagingtoolbar in two views (separate files), how can I query them both in the controller?
dockedItems: [{
xtype: 'pagingtoolbar',
store: 'User',
dock: 'bottom',
displayInfo: true
}]
bbar: {
xtype: 'pagingtoolbar',
store: this.store,
displayInfo: true
}
Upvotes: 2
Views: 235
Reputation: 4760
Just adding to Alex Tokarev's answer, if you want to select them at run time, lets say, when you click on a button, you can use:
...
handler : function () {
var mytoolbars = Ext.ComponentQuery.query('pagingtoolbar'); // will assign all available toolbars to your mytoolbars array.
}
....
Upvotes: 1
Reputation: 4861
Controllers use ComponentQuery and their selectors are global, so just xtype should work:
Ext.define('MyController', {
extend: 'Ext.app.Controller',
init: function() {
this.control({
pagingtoolbar: {
...
}
});
}
});
Upvotes: 1