首页 新闻 赞助 找找看

Extjs5.0分页问题

0
悬赏园豆:20 [已关闭问题] 关闭于 2015-08-25 17:15

其他全部好用,但就是 当前页面为第2页时 点击上一页 页码会变,但是数据还是第二页的数据

Ext.define('HJ.UserAdmin.Users', {
        extend: 'Ext.data.Model',

        requires: [
            'Ext.data.Field'
        ],

        fields: [
            {
                name: 'ID'
            },
            {
                name: 'USERNAME'
            },
            {
                name: 'PASSWORD'
            }
        ]
    });

    Ext.define('HJ.UserAdmin.UsersStore', {
        extend: 'Ext.data.Store',
        model: 'HJ.UserAdmin.Users',
        autoLoad: false,
        pageSize: 2,
        //baseParams: {start: 0, limit: 2},
        proxy: {
            type: 'ajax',
            url: '/ManagePage/UserList',
            reader: {
                type: 'json',
                root: 'data',
                totalProperty: 'total'
            }
        },
        listeners: {
            exception: function (proxy, response, operation) {
                Ext.MessageBox.show({
                    title: '服务器端异常',
                    msg: operation.getError(),
                    icon: Ext.MessageBox.ERROR,
                    buttons: Ext.Msg.OK
                });
            }
        }
    });
    var storeUser = Ext.create('HJ.UserAdmin.UsersStore', {});
    storeUser.load({ params: { start: 0, limit: 2} });

    var UserListPanel = Ext.create('Ext.grid.Panel', {
        id: 'UserListPanel',
        frame: false,
        loadMask: true,
        columnLines: true,
        autoScroll: true,
        //height: Ext.getBody().getViewSize().height - 84,
        store: storeUser,
        //bodyStyle: 'background-color:#E7F4FA',
        bodyStyle: {
            background: 'url(../pictures/CenterBG.png)'
        },
        columns: [{
            xtype: 'gridcolumn',
            dataIndex: 'ID',
            text: '用户ID'
        },
            {
                xtype: 'gridcolumn',
                //width: 200,
                defaultWidth: 200,
                dataIndex: 'USERNAME',
                text: '用户名称'
            },
             {
                 xtype: 'gridcolumn',
                 width: 200,
                 defaultWidth: 200,
                 dataIndex: 'PASSWORD',
                 text: '用户密码'
             },
            {
                text: '编辑',
                //width: 50,
                menuDisabled: true,
                xtype: 'actioncolumn',
                tooltip: '编辑部门',
                align: 'center',
                iconCls: 'IconEdit',
                handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
                    CreateUserEdit('U', record);
                } //,
            }, {
                text: '删除',
                //width: 50,
                menuDisabled: true,
                xtype: 'actioncolumn',
                tooltip: '删除部门',
                align: 'center',
                iconCls: 'IconDel',
                handler: function (grid, rowIndex, colIndex, actionItem, event, record, row) {
                    Ext.MessageBox.confirm('确认', '确认要删除该用户吗?', function (btn, text) {
                        if (btn == 'yes') {
                            DelUser(record.data.USERID);
                        }
                        else {
                            return;
                        }
                    }, this);
                }
            }
        ],
        dockedItems: [{
            xtype: 'toolbar',
            items: [{
                text: '新建用户',
                tooltip: '新建用户',
                iconCls: 'IconAdd',
                handler: function () {
                    CreateUser();
                }
            }, {
                xtype: 'textfield',
                id: 'txtUserName',
                width: 260,
                emptyText: '输入用户姓名查询用户'
            }, {
                xtype: 'button',
                text: '查询',
                handler: function () {
                    var username = Ext.getCmp('txtUserName').getValue();
                    SearchUserByName(username);
                }
            }]
        },
        {
            dock: 'bottom',
            xtype: 'pagingtoolbar',
            name: 'userlistpbar',
            store: storeUser,
            displayInfo: true,
            //displayMsg: 'Topics {0} - {1} of {2}',
            emptyMsg: '没有查找到相应数据'
            //listeners: {
            //    'change': function () {
            //    }
            //}
        }
        ]
    });
BHongyi的主页 BHongyi | 初学一级 | 园豆:77
提问于:2015-08-25 15:56
< >
分享
所有回答(1)
0

是版本问题。。换个Extjs包就OK了。。

BHongyi | 园豆:77 (初学一级) | 2015-08-25 17:15
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册