在利用ExtJs4.2进行分页时,能够从后台获取到Json数据,但在Grid中只能看到有一条记录,而且是空的,帮忙看下为什么分页不成功
//数据部分
var maillist = Ext.create('Ext.data.Store', {
buffered: false,
autoLoad: true,
fields: ['SenderTrueName',
{ name: 'SendDate', type: 'date', dateFormat: 'timestamp' },
'Title', 'Status', 'Id', 'Checked'],
proxy: {
waitTitle: '提示',
waitMsg: '正在载入邮件数据...',
type: 'ajax',
url: '/Data/getMailList?UserId=' + UserId + '&Flag=' + Flag
},
reader: {
type: 'json',
totalProperty: 'Total',
root: 'mails' },
pageSize: 18
}); //表格部分
var mailtable = Ext.create('Ext.grid.Panel', {
width: Ext.innerWidth,
height: Ext.innerHeigh,
forceFit: true,
autoScroll: true,
buffered: true,
store: maillist,
columns: [
{ xtype: 'rownumberer', header: '', width: 30 },
{ xtype: 'checkcolumn', header: '', width: 30, dataIndex: 'Checked' },
{ header: '发件人', dataIndex: 'SenderTrueName', width: 100 },
{ header: '邮件主题', dataIndex: 'Title', width: 300 },
{ header: '发件时间', dataIndex: 'SendDate', width: 120 },
{ header: '附件数量', dataIndex: 'AttachCount', width: 55 },
{ header: '状态', dataIndex: 'Status', width: 45 },
{ header: 'id', dataIndex: 'Id', width: 20, hidden: true }
],
selModel: new Ext.selection.Model({ mode: 'SIMPLE' }),
//分页工具栏
bbar: [{
xtype: 'pagingtoolbar',
pageSize: 18,
store: maillist,
displayInfo: true,
displayMsg: '第 {0} 页/共{1}邮件 邮箱中总计邮件{2}封 '}],
listeners: {
//邮件表格事件
}
}); //后台返回的数据
{ Total:266,mails:[{"SenderTrueName":"111","SendDate":"\/Date(1361525528000)\/","Status":"111","Title":"11","Id":6423327,"SenderId":"12593"},{"SenderTrueName":"1111","SendDate":"\/Date(1365919356000)\/","Status":"11","Title":"1111","Id":7176496,"SenderId":"44"}]}Ext分页失败
//数据部分
var maillist = Ext.create('Ext.data.Store', {
buffered: false,
autoLoad: true,
fields: ['SenderTrueName',
{ name: 'SendDate', type: 'date', dateFormat: 'timestamp' },
'Title', 'Status', 'Id', 'Checked'],
proxy: {
waitTitle: '提示',
waitMsg: '正在载入邮件数据...',
type: 'ajax',
url: '/Data/getMailList?UserId=' + UserId + '&Flag=' + Flag
},
reader: {
type: 'json',
totalProperty: 'Total',
root: 'mails' },
pageSize: 18
}); //表格部分
var mailtable = Ext.create('Ext.grid.Panel', {
width: Ext.innerWidth,
height: Ext.innerHeigh,
forceFit: true,
autoScroll: true,
buffered: true,
store: maillist,
columns: [
{ xtype: 'rownumberer', header: '', width: 30 },
{ xtype: 'checkcolumn', header: '', width: 30, dataIndex: 'Checked' },
{ header: '发件人', dataIndex: 'SenderTrueName', width: 100 },
{ header: '邮件主题', dataIndex: 'Title', width: 300 },
{ header: '发件时间', dataIndex: 'SendDate', width: 120 },
{ header: '附件数量', dataIndex: 'AttachCount', width: 55 },
{ header: '状态', dataIndex: 'Status', width: 45 },
{ header: 'id', dataIndex: 'Id', width: 20, hidden: true }
],
selModel: new Ext.selection.Model({ mode: 'SIMPLE' }),
//分页工具栏
bbar: [{
xtype: 'pagingtoolbar',
pageSize: 18,
store: maillist,
displayInfo: true,
displayMsg: '第 {0} 页/共{1}邮件 邮箱中总计邮件{2}封 '}],
listeners: {
//邮件表格事件
}
}); //后台返回的数据
{ Total:266,mails:[{"SenderTrueName":"111","SendDate":"\/Date(1361525528000)\/","Status":"111","Title":"11","Id":6423327,"SenderId":"12593"},{"SenderTrueName":"1111","SendDate":"\/Date(1365919356000)\/","Status":"11","Title":"1111","Id":7176496,"SenderId":"44"}]}Ext分页失败
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货