Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hbulens/f3cd88fb12717f7c74852ea4dfd49944 to your computer and use it in GitHub Desktop.
Save hbulens/f3cd88fb12717f7c74852ea4dfd49944 to your computer and use it in GitHub Desktop.
Ext.define('Ext.toolbar.PagingComboToolbar', {
extend: 'Ext.PagingToolbar',
displayInfo: false,
pageSize: 50,
initComponent: function() {
var me = this;
this.store.pageSize = this.pageSize;
var combo = new Ext.form.ComboBox({
name: 'perpage',
width: 75,
store: new Ext.data.ArrayStore({
fields: ['id'],
data: [
['10'],
['20'],
['50'],
['75'],
['100'],
['150']
]
}),
value: this.pageSize,
listWidth: 70,
triggerAction: 'all',
displayField: 'id',
valueField: 'id',
editable: false,
forceSelection: true,
listeners: {
select: {
fn: function(combo, record) {
var newPagesize = parseInt(record.get('id'), 10);
this.pageSize = newPagesize;
this.store.pageSize = newPagesize;
this.store.loadPage(this.store.currentPage);
},
scope: this
}
}
});
Ext.apply(this, {
items: ['Per page: ', combo]
});
this.callParent(arguments);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment