文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Extjs分页

Extjs分页

时间:2011-03-24  来源:Seven_Milk

Extjs分页好像只能从aspx页面取数据,因为如果从webservice中取数据,totalProperty不知道怎么设置,这样总页数是不对的。

从aspx页面取数据,页面能接收到start, limit参数

 Ext.onReady(function () {
            Ext.QuickTips.init();
            Ext.form.Field.prototype.msgTarget = 'side';

            bJsonReader = Ext.extend(Ext.data.JsonReader, {
                read: function (response) {
                    var json = response.responseText;
                    //alert(json);
                    var o = Ext.decode(json);
                    //alert(o.d);
                    this.responseText = json;
                    if (!o) {
                        throw { message: 'JsonReader.read: Json object not found' };
                    }
                    return this.readRecords(o.d);
                }
            });

            var ds = new Ext.data.Store({
                proxy: new Ext.data.HttpProxy({
                    url: "WebService.asmx/GeneralListPaging", method: 'POST', jsonData: { CurPageIndex: 0 }
                }),
                reader: new bJsonReader({
                    fields: [{ name: 'UserID', type: 'string' },
                             { name: 'LogonName', type: 'string' },
                             { name: 'UserName', type: 'string' },
                             { name: 'Password', type: 'string' },
                             { name: 'dtDateTime', type: 'string'}]
                })
            });

            var Colnum = new Ext.grid.ColumnModel([
                    { header: 'UserID', dataIndex: 'UserID', hidden: false, align: 'right', sortable: true },

                    { header: 'LogonName', dataIndex: 'LogonName', sortable: true,
                        editor: new Ext.form.TextField({ allowBlank: false })
                    },

                    { header: 'UserName', dataIndex: 'UserName', sortable: true,
                        editor: new Ext.form.TextField({ allowBlank: false })
                    },

                    { header: 'Password', dataIndex: 'Password', sortable: true,
                        editor: new Ext.form.TextField({ allowBlank: false })
                    },

                    { header: 'DateTime', dataIndex: 'dtDateTime', sortable: true,
                        editor: new Ext.form.TextField({ allowBlank: false })
                    },

                    { header: 'Email', dataIndex: 'Email', sortable: true, width: 200,
                        editor: new Ext.form.TextField({ allowBlank: false })
                    }
                    ]);


            var pagebar = new Ext.PagingToolbar({
                pageSize: 10,
                store: ds,
                displayInfo: true,
                displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
                emptyMsg: "没有记录"
            });

            var grid = new Ext.grid.GridPanel({
                renderTo: 'grid',
                autoHeight: true,
                store: ds,
                cm: Colnum,
                viewConfig: {
                    autoFill: true
                },
                bbar: pagebar
            });
            //pagebar.on("change", function (bar, obj) { alert(obj.activePage); });
            //store.load({ params: { start: 0, limit: 3} });
            ds.load();
        });

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载