extjs分页添加pagesize

var tool_bar_1 = new Ext.PagingToolbar({
        pageSize: 50,
        store: store,
        displayInfo: true,
        displayMsg: 'Displaying topics {0} - {1} of {2}',
        emptyMsg: "No topics to display",
        items: [
                {xtype:'label', text: 'page size:'},
                {xtype:'numberfield', width:35, value: 50,minValue:1,fieldLabel:'page size:',
                    allowBlank: false,
                    listeners:
                    {
                        change:function(Field, newValue, oldValue)
                        {
                            var num = parseInt(newValue);
                            if (isNaN(num) || !num || num<1)
                            {
                                num = 50;
                                Field.setValue(num);
                            }
                            tool_bar_1.pageSize = num;
                        }
                    }
                }]
    });
    var tool_bar = [tool_bar_1, '-', {text:'other button'}];
    var grid = new Ext.grid.GridPanel({bbar: tool_bar});

你可能感兴趣的:(ext)