Created
January 11, 2018 19:45
-
-
Save hbulens/f3cd88fb12717f7c74852ea4dfd49944 to your computer and use it in GitHub Desktop.
This file contains 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.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