最好带分页。

解决方案 »

  1.   


    var pageSize = 20;
            var fields = ["ROLE_ID", "ROLE_NAME", "ROLE_RIGHT", "ROLE_REMARK"];
            roleStore = new Ext.data.Store({
                proxy: new Ext.data.HttpProxy(
                   {
                       url: "DATA/role/rolelist.aspx",
                       method: "POST"
                   }),
                reader: new Ext.data.JsonReader(
               {
                   fields: fields,
                   root: "data",
                   id: "ROLE_ID",
                   totalProperty: "totalCount"
               })
            });
            roleStore.load({ params: { start: 0, limit: pageSize} });
            var sm = new Ext.grid.CheckboxSelectionModel({
                dataIndex: "ROLE_ID"
            });        var roleGrid = new Ext.grid.GridPanel({
                store: roleStore,
                id: "role_Grid",
                sm: sm,
                columns: [sm,
                {
                    id: 'rolename',
                    header: '角色名',
                    width: 160,
                    sortable: true,
                    dataIndex: 'ROLE_NAME'
                },
                {
                    header: '角色权限',
                    id: 'ro_right',
                    sortable: true,
                    dataIndex: 'ROLE_RIGHT'
                },
                {
                    header: '描述',
                    width: 200,
                    sortable: true,
                    dataIndex: 'ROLE_REMARK'
                }],
                viewConfig: {
                    columnsText: "显示/隐藏列",
                    sortAscText: "正序排列",
                    sortDescText: "倒序排列"
                    //forceFit: true
                },
                bbar: new Ext.PagingToolbar({
                    store: roleStore,
                    pageSize: pageSize,
                    displayInfo: true,
                    displayMsg: '当前记录 {0} -- {1} 条 共 {2} 条记录',
                    emptyMsg: "No results to display",
                    prevText: "上一页",
                    nextText: "下一页",
                    refreshText: "刷新",
                    lastText: "最后页",
                    firstText: "第一页",
                    beforePageText: "当前页",
                    afterPageText: "共{0}页"
                }),
                tbar: [
             new Ext.Toolbar.Fill()
                    , "", "-", "", {
                        text: "添加",
                        tooltip: "添加角色",
                        iconCls: "addicon",
                       
                    }
             , "", "-", "", {
                 text: "编辑",
                 tooltip: "编辑",
                 iconCls: "editicon",
                 id: 'editrole',
                 handler: editRole
             }, "", "-", "", {
                 text: "删除",
                 tooltip: "删除",
                 id: 'delrole',
                 iconCls: "deleteicon",
                 handler: delRole
             }, "-"],
                listeners: {
                    'contextmenu': function (e) {
                        e.stopEvent();
                    }
                },
                loadMask: true,
                stripeRows: true,
                autoExpandColumn: 'ro_right',
                autoScroll: true,
                height: 350,
                stateful: false,
                stateId: 'grid'
            });
      

  2.   

    后台
    json = "{totalCount:" + count + ",data:" + json + "}";
    Response.Write(json);