Ext实现后台分页的问题,只返回第一页的数据,就没法往后翻页了?
Ext.onReady(function(){varcm=newExt.grid.ColumnModel([{header:'编号',dataIndex:'id'},{h...
Ext.onReady(function(){
var cm=new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'id'},
{header:'密码',dataIndex:'password'},
{header:'姓名',dataIndex:'name'},
{header:'邮箱',dataIndex:'email'}
]);
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'deal'}),
reader: new Ext.data.JsonReader(
{
remoteSort: true,
totalProperty:'totalProperty',
root:'root',
fields:[
{name:'id'},
{name:'password'},
{name:'name'},
{name:'email'}
]
})
});
ds.on('beforeload',function(){
});
// create the Grid
var grid = new Ext.grid.GridPanel({
store: ds,
cm:cm,
stripeRows: true,
height:320,
width:600,
title:'Sliding Pager',
bbar:new Ext.PagingToolbar({
pageSize:5,
store:ds,
displayInfo:true,
displayMsg:'显示第{0}到第{1}条数据,共{2}条',
emptyMsg:'没有记录'
})
});
grid.render('grid');
ds.load({params:{start:0,limit:5}});
});
代码就是这样,返回的纪录是前五条,而数据库中总记录有十一条,在bbar中也只有一页,没法往后翻页了 展开
var cm=new Ext.grid.ColumnModel([
{header:'编号',dataIndex:'id'},
{header:'密码',dataIndex:'password'},
{header:'姓名',dataIndex:'name'},
{header:'邮箱',dataIndex:'email'}
]);
var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'deal'}),
reader: new Ext.data.JsonReader(
{
remoteSort: true,
totalProperty:'totalProperty',
root:'root',
fields:[
{name:'id'},
{name:'password'},
{name:'name'},
{name:'email'}
]
})
});
ds.on('beforeload',function(){
});
// create the Grid
var grid = new Ext.grid.GridPanel({
store: ds,
cm:cm,
stripeRows: true,
height:320,
width:600,
title:'Sliding Pager',
bbar:new Ext.PagingToolbar({
pageSize:5,
store:ds,
displayInfo:true,
displayMsg:'显示第{0}到第{1}条数据,共{2}条',
emptyMsg:'没有记录'
})
});
grid.render('grid');
ds.load({params:{start:0,limit:5}});
});
代码就是这样,返回的纪录是前五条,而数据库中总记录有十一条,在bbar中也只有一页,没法往后翻页了 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询