1. 程式人生 > >Ext Grid 設置每頁記錄數pageSize

Ext Grid 設置每頁記錄數pageSize

div brush def plugin value clas func edit true

  Ext.define(‘Ext.ux.ComboPageSize‘, {
            alias: ‘plugin.combopagesize‘,
            requires: [
                ‘Ext.form.field.ComboBox‘
            ],
            pageSizes: [30, 50, 100, 200, 300],
            constructor: function (config) {
                if (config) {
                    Ext.apply(this, config);
                }
            },
            init: function (pbar) {
                var combo,
                    me = this;
                combo = Ext.widget(‘combo‘, {
                    width: 70,
                    editable: false,
                    store: me.pageSizes,
                    listeners: {
                        change: function (s, v) {
                            pbar.store.pageSize = v;
                            pbar.store.loadPage(1);
                        }
                    }
                });
                pbar.add(13, ‘-‘);
                pbar.add(14,combo);
                combo.setValue(pbar.store.pageSize);
            }
        });

  

Ext Grid 設置每頁記錄數pageSize