PDA

View Full Version : saki PageSizePlugin in Extjs 4



capn
15 Jul 2011, 11:34 AM
Anyone using PageSizePlugin by saki in Ext 4? I am migrating the code now, but just curious if anyone else has already?


2.2 code below:



Ext.ux.PageSizePlugin = function(config) {
Ext.apply(this, config);

Ext.ux.PageSizePlugin.superclass.constructor.call(this, {
store: new Ext.data.SimpleStore({
fields: ['text', 'value'],
data: [['25', 25], ['100', 100], ['500', 500], ['1000', 1000]]
}),
mode: 'local',
displayField: 'text',
valueField: 'value',
allowBlank: false,
triggerAction: 'all',
width: 50,
maskRe: /[0-9]/
});
};

Ext.extend(Ext.ux.PageSizePlugin, Ext.form.ComboBox, {
beforeText:'',
afterText:'',
init: function(paging) {
paging.on('render', this.onInitView, this);
},

onInitView: function(paging) {
paging.add('-', this.beforeText, this, this.afterText);
this.setValue(paging.pageSize);
this.on('select', this.onPageSizeChanged, paging);
this.on('specialkey', function(combo, e) {
if(13 === e.getKey()) {
this.onPageSizeChanged.call(paging, this);
}
});

},

onPageSizeChanged: function(combo) {
this.pageSize = parseInt(combo.getRawValue(), 10);
this.doLoad(0);
}
});