EXT中的GRID分页示例

 
EXT中的GRID分页示例
2008-12-15 10:21

Ext.onReady(function(){
           
                           
                            var store = new Ext.data.JsonStore({
                                            url: '1.aspx',
                                            root: 'Result',
                                            fields: ['id', 'name'],
                                            autoLoad:true,
                                            totalProperty: 'RowCount'
                                        });
  
                            var grid = new Ext.grid.GridPanel({
                                            renderTo:Ext.getBody(),
                                            store:store,
                                            columns: [
                                                {header: "id", width: 200, sortable: true, dataIndex: 'id'},                                               
                                                {header: "name", width: 120, sortable: true, dataIndex: 'name'}
                                            ],
                                            viewConfig: {
                                                forceFit: true
                                            },
                                         
                                            width:600,
                                            height:300,
                                            frame:true,
                                            title:'Framed with Checkbox Selection and Horizontal Scrolling' ,
                                           
                                            bbar: new Ext.PagingToolbar({
                                            pageSize: 2,
                                            store:store,
                                            displayInfo: true,
                                            displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
                                            emptyMsg: "无显示数据"
                                            })

                                        });

            })

后台代码:

string limit = Request["limit"];
        string start = Request["start"];


        string jsonstring = "{ PageSize:2, RowCount:10, Result:[";


        if (string.IsNullOrEmpty(start))
        { //第一次
            jsonstring += "{'id':1,name:'n1'},{'id':2,name:'n2'}";
            jsonstring += "]}";

            Response.Write(jsonstring);

        }
        else
        {
            Response.Write("{ PageSize:4, RowCount:10, Result:[{'id':3,name:'n3'},{'id':4,name:'n4'}]}");

            //,{'id':5,name:'n5'},{'id':6,name:'n6'},{'id':7,name:'n7'},{'id':8,name:'n8'},{'id':9,name:'n9'},{'id':10,name:'n10'}]}");


        }

以后台分页实现

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值