Ext.ux.PageSizePlugin.js 949 B

1234567891011121314151617181920212223242526272829303132333435
  1. Ext.ux.PageSizePlugin = function() {
  2. Ext.ux.PageSizePlugin.superclass.constructor.call(this, {
  3. store: new Ext.data.SimpleStore({
  4. fields: ['text', 'value'],
  5. data: [['10', 10], ['20', 20], ['30', 30], ['50', 50], ['100', 100]]
  6. }),
  7. mode: 'local',
  8. displayField: 'text',
  9. valueField: 'value',
  10. editable: false,
  11. allowBlank: false,
  12. triggerAction: 'all',
  13. width: 40
  14. });
  15. };
  16. Ext.extend(Ext.ux.PageSizePlugin, Ext.form.ComboBox, {
  17. init: function(paging) {
  18. paging.on('render', this.onInitView, this);
  19. },
  20. onInitView: function(paging) {
  21. paging.add('-',
  22. this,
  23. '-'
  24. );
  25. this.setValue(paging.pageSize);
  26. this.on('select', this.onPageSizeChanged, paging);
  27. },
  28. onPageSizeChanged: function(combo) {
  29. this.pageSize = parseInt(combo.getValue());
  30. this.doLoad(0);
  31. }
  32. });