extjs 分页 显示出的记录总是少一些数据

cxllyg 2011-07-29 10:05:18
数据显示出来了,总数是对的,但显示到控件上的记录数不对,总是少一些,怎么回事呢
...全文
244 12 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
cxllyg 2011-07-30
  • 打赏
  • 举报
回复
谢谢各位了,我搞定了~
如果第一个字段的键值为id,重复的id一般就只显示一次了,我把第一个字段的id改为xuehao就可以了
豆虫 2011-07-30
  • 打赏
  • 举报
回复
把你后台返回的数据格式打印下 晒出来~~~
MuBeiBei 2011-07-30
  • 打赏
  • 举报
回复
[Quote=引用 8 楼 cxllyg 的回复:]
后台输出的json数据也是对的,但显示的时候有的数据就没有了
[/Quote]

呃~·那你只能打断点一步一步的找问题了~·
cxllyg 2011-07-30
  • 打赏
  • 举报
回复
后台输出的json数据也是对的,但显示的时候有的数据就没有了
lsw645645645 2011-07-30
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 cxllyg 的回复:]
谢谢各位了,我搞定了~
如果第一个字段的键值为id,重复的id一般就只显示一次了,我把第一个字段的id改为xuehao就可以了
[/Quote]

原来是这样啊。
MuBeiBei 2011-07-29
  • 打赏
  • 举报
回复
后台输出一下内容,看看是否正确
MuBeiBei 2011-07-29
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 cxllyg 的回复:]
为什么有的记录显示出来了,有的记录就没显示出来呢?但'显示第 {0} 条到 {1} 条记录,一共 {2} 条'里面的一共几条是对的,也就是总数是对的,但显示出来的却没有那些记录
[/Quote]

没拿到数据吧~·
cxllyg 2011-07-29
  • 打赏
  • 举报
回复
为什么有的记录显示出来了,有的记录就没显示出来呢?但'显示第 {0} 条到 {1} 条记录,一共 {2} 条'里面的一共几条是对的,也就是总数是对的,但显示出来的却没有那些记录
cxllyg 2011-07-29
  • 打赏
  • 举报
回复
var sm = new Ext.grid.CheckboxSelectionModel();

var cm = new Ext.grid.ColumnModel([
new Ext.grid.RowNumberer(),
sm,
{header:'学号',dataIndex:'id',align:'center'},
{header:'姓名',dataIndex:'name',align:'center'},
{header:'缴费金额',dataIndex:'money',align:'center'},
{header:'缴费日期',dataIndex:'date',align:'center'}

]);
cm.defaultSortable = true;

var ds = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:'http://localhost:8080/meto/json.do'}),
reader: new Ext.data.JsonReader({
totalProperty: 'totalProperty',
root: 'root'
}, [
{name: 'id'},
{name: 'name'},
{name: 'money'},
{name: 'date'}
])
});


var grid = new Ext.grid.GridPanel({
el: 'grid3',
ds: ds,
cm: cm,
sm: sm,
height:320,
width:450,
loadMask: {msg:'正在加载数据,请稍侯……'},
columnLines:true,
stripeRows:true,
// autoHeight:true,


title: '统计结果',
bbar: new Ext.PagingToolbar({
pageSize: 10,
store: ds,
displayInfo: true,
displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
emptyMsg: "没有记录"
}),
tbar: new Ext.PagingToolbar({
pageSize: 10,
store: ds,
displayInfo: true,
displayMsg: '显示第 {0} 条到 {1} 条记录,一共 {2} 条',
emptyMsg: "没有记录"
})
});
ds.load({params:{start:0,limit:10}});
grid.render();

});



应该是对的 是不是那两条记录有太多重复的数据?
豆虫 2011-07-29
  • 打赏
  • 举报
回复
前台看下是否正确 参照我的这个demo看看
var grid = new Ext.grid.GridPanel({
store : store,//store我就略了啊
columns : [{
id : 'A',
header : "A",
width : 30,
sortable : true,
dataIndex : 'A'
}, {
header : "B",
width : 75,
sortable : true,
dataIndex : 'B'
}, {
header : "C",
width : 75,
sortable : true,
dataIndex : 'C'
}, {
header : "D",
width : 75,
sortable : true,
dataIndex : 'D'
}, {
header : "E",
width : 50,
sortable : true,
dataIndex : 'E'
}],
stripeRows : true,
autoExpandColumn : 'A',
height : 393,
width : 600,
title : 'aaa',
bbar : new Ext.PagingToolbar({
pageSize : 12,// 每页显示的记录值
store : store,
displayInfo : true,
displayMsg : '总记录数 {0} - {1} of {2}',
emptyMsg : "没有记录"
})
});
grid.render('div的id');
store.load({ params: { start: 0, limit: 12} });
豆虫 2011-07-29
  • 打赏
  • 举报
回复
store.load({ params: { start: 0, limit: 12} });
后台的分页处理对么?
cxllyg 2011-07-29
  • 打赏
  • 举报
回复
比如,json数据为:
{totalProperty:2,root:[{'id':'040730212','name':'chen','money':'20','date':'2011-07-20'},{'id':'040730212','name':'chen','money':'40','date':'2011-07-20'}]}

grid中显示一共两条记录,这是对的,但只有一条记录在控件上

87,997

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧