Gridview 网格面板不工作的Extjs分页工具栏
我有下面的代码在extjs中分页。。。即使我把它设置为每页5条记录,它仍然显示6条。。。第1页(共2页)未显示“1”。。。我对来自sql的数据有问题。。。。所以我决定尝试使用内存存储。。。但是我仍然没有正确的寻呼。。。。有什么帮助吗Gridview 网格面板不工作的Extjs分页工具栏,gridview,extjs,paging,Gridview,Extjs,Paging,我有下面的代码在extjs中分页。。。即使我把它设置为每页5条记录,它仍然显示6条。。。第1页(共2页)未显示“1”。。。我对来自sql的数据有问题。。。。所以我决定尝试使用内存存储。。。但是我仍然没有正确的寻呼。。。。有什么帮助吗 constructor: function () { this.callParent(arguments); var store = Ext.create('Ext.data.Store', { pageSize: 5,
constructor: function () {
this.callParent(arguments);
var store = Ext.create('Ext.data.Store', {
pageSize: 5,
storeId: 'simpsonsStore',
fields: ['name', 'email', 'phone'],
data: {
'totalCount': "6",
'items': [{
'name': 'Lisa',
"email": "lisa@simpsons.com",
"phone": "555-111-1224"
}, {
'name': 'Bart',
"email": "bart@simpsons.com",
"phone": "555-222-1234"
}, {
'name': 'Homer',
"email": "home@simpsons.com",
"phone": "555-222-1244"
}, {
'name': 'Marge',
"email": "marge@simpsons.com",
"phone": "555-222-1254"
}, {
'name': '29',
"email": "marge@simpsons.com",
"phone": "555-222-1254"
}, {
'name': '30',
"email": "marge@simpsons.com",
"phone": "555-222-1254"
}]
},
proxy: {
type: 'memory',
reader: {
type: 'json',
root: 'items',
totalProperty: 'totalCount'
}
}
});
this.grid = Ext.create('Ext.grid.Panel', {
title: 'Simpsons',
disableSelection: true,
loadMask: true,
stripeRows: true,
trackover: true,
renderTo: Ext.getBody(),
store: store,
columns: [{
text: 'Name',
dataIndex: 'name'
}, {
text: 'Email',
dataIndex: 'email'
}, {
text: 'Phone',
dataIndex: 'phone'
}],
bbar: Ext.create('Ext.PagingToolbar', {
store: store,
displayInfo: true,
displayMsg: 'Displaying Surveys {0} - {1} of {2}',
emptyMsg: "No Surveys to display"
})
});
grid.loadPage(1);
}
}
}); 内存代理无法与常规分页机制一起工作。您需要一个特殊的用户扩展类:向下滚动到“使用本地数据分页”部分。尝试向数据添加id属性。谢谢dbrin。。。我知道我必须使用本地数据进行分页,但假设使用静态数据会有所不同。