首页 新闻 会员 周边 捐助

ExtJs4.0 grid分页,没有效果

0
悬赏园豆:15 [已关闭问题] 关闭于 2012-07-09 12:41

代码:

        Ext.onReady(function() {
            var itemsPerPage = 2;
            var store = Ext.create('Ext.data.Store', {
                autoLoad: { start: 0, limit: itemsPerPage },
                fields: ['id', 'name', 'age'],
                pageSize: itemsPerPage,
                proxy: {
                    type: 'ajax',
                    url: 'Handler1.ashx',
                    reader: {
                        type: 'json',
                        root: 'rows',
                        totalProperty: 'results'
                    }
                }


            });

 

          var grid=   Ext.create('Ext.grid.Panel', {
                title: 'Paging',
                renderTo: Ext.getBody(),
                width: 400,
                height: 350,
                frame: true,
                store: store,
                forceFit: true,
                columns: [
                { header: 'id', width: 30, dataIndex: 'id', sortable: true },
                { header: 'name', width: 80, dataIndex: 'name', sortable: true },
                { header: 'age', width: 80, dataIndex: 'age', sortable: true }
                ],
                bbar: [
                {
                    xtype: 'pagingtoolbar',
                    store: store,
                    displayInfo: true


                }
                ]
            });
            store.load({ params: { start: 0, limit: 2} });

        });

 

后台:

  string sql = "select * from test";
            string constr=ConfigurationManager.AppSettings["conn"];
            DataTable dt = new DataTable();
            using (SqlConnection conn = new SqlConnection(constr))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand(sql, conn);
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(dt);
            }

 

            int total = dt.Rows.Count;

 

      context.Response.Write(Dtb2Json(dt,total)); 

返回Json绝对没有问题。

其效果:

我一共6条数据,每页显示2条,但每次都是6条,请问大哥们,帮忙看看把,指点一下,谢谢

Peter.zhong的主页 Peter.zhong | 初学一级 | 园豆:117
提问于:2012-07-07 18:08
< >
分享
所有回答(1)
0
Peter.zhong | 园豆:117 (初学一级) | 2012-07-09 12:41
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册