ExtJS ArrayStore 的分页问题
我正在 ExtJS 中尝试一些东西,包括显示具有不同功能的网格。
在我的页面中,我首先声明一个包含大约一百个数据的 Javascript 数组,并将其存储在名为 myArray
的变量中。
然后,我执行以下操作:
Ext.define('Fund2',{
extend:'Ext.data.Model',
fields:[{name:'Id'},
{name:'Id2'},
{name:'Name'},
{name:'Name2'},
{name:'Name3'},
{name:'Name4'},
{name:'Param1'},
{name:'Param2'},
{name:'Param3'}]
});
var myStore2=Ext.create('Ext.data.ArrayStore',{
model:'Fund2',
data:myArray,
pageSize:10
});
Ext.create('Ext.grid.Panel',{
renderTo:'div2',
store:myStore2,
height:500,
width:500,
columns:[{text:'Id',dataIndex:'Id'},
{text:'Name',dataIndex:'Name'},
{text:'Additional',dataIndex:'Param1'}],
dockedItems:[{
xtype: 'pagingtoolbar',
store:myStore2,
dock: 'bottom',
displayInfo: true
}]
});
在页面上,网格面板正确显示并填充数据。
分页工具栏也可用并计算正确的页面数量。
然而,数据并没有被“分页”;所有记录都显示在网格中。
你知道我哪里做错了吗?
I am trying out a few things in ExtJS including displaying a grid with different functionalities.
In my page, I first declare a Javascript Array of about a hundred data which I store in a variable called myArray
Then, I do the following:
Ext.define('Fund2',{
extend:'Ext.data.Model',
fields:[{name:'Id'},
{name:'Id2'},
{name:'Name'},
{name:'Name2'},
{name:'Name3'},
{name:'Name4'},
{name:'Param1'},
{name:'Param2'},
{name:'Param3'}]
});
var myStore2=Ext.create('Ext.data.ArrayStore',{
model:'Fund2',
data:myArray,
pageSize:10
});
Ext.create('Ext.grid.Panel',{
renderTo:'div2',
store:myStore2,
height:500,
width:500,
columns:[{text:'Id',dataIndex:'Id'},
{text:'Name',dataIndex:'Name'},
{text:'Additional',dataIndex:'Param1'}],
dockedItems:[{
xtype: 'pagingtoolbar',
store:myStore2,
dock: 'bottom',
displayInfo: true
}]
});
On th page, the grid panel is displayed properly and filled with the data.
The paging toolbar is also available and computes the right amount of pages.
However, the data is not "paged"; all the records are shown in the grid.
Do you know where I made a mistake?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
添加此:
完整版:
Add this:
Full version:
我使用解决了类似的问题
Ext.ux.data.PagingMemoryProxy< /a>
效果很好
考虑到它不在 ExtJS 4 的标准版本中,您必须手动包含它
i solved a similar problem using the
Ext.ux.data.PagingMemoryProxy
which works pretty well
consider that it's not in the standart build of ExtJS 4, you have to manually include it