JsonPagingGridPanel =Ext.extend(Ext.grid.GridPanel,{ constructor:function(){ this["store"]:new Ext.data.Store({ url:"", //reader解析 reader:new Ext.data.JsonReader({ //autoLoad:true, root:"rows",//解析指定xml的节点 //分页需要的属性(数量) totalProperty:"count" },Ext.data.Record.create(["id","type","money"]) ) }); JsonPagingGridPanel.superclass.constructor.call(this,{ renderTo:Ext.getBody(), width:300, height:400, //baseParams:{start:0,limit:5} //可以选择行数 sm:new Ext.grid.RowSelectionModel({ //设置为单选 singleSelect:true } bbar:new Ext.PagingToolbar({ store:this.store, //一页显示多少个 pageSize:5 }), //绑定store中的数据到列中 columns:[{ header:"类型", dataIndex:"type" },{ header:"金额", dataIndex:"money" }] }); /* this.getStore().on("load",function(_store){ //_store.getTotalCount()中值的数量 alert(_store.getTotalCount()); });*/ this.getStore().load({params:{start:0,limit:5}}); } });