如何向 extjs 4 网格添加分页?
我有一个像这样的商店,我用于 extjs 网格,
Ext.create('Ext.data.Store', {
autoLoad : true,
fields : [
{name: 'item_code', mapping: 'item_code', type: 'string'},
{name: 'quantity', mapping: 'quantity', type: 'string'},
{name: 'description', mapping: 'description', type: 'string'},
{name: 'selling_price', mapping: 'selling_price', type: 'string'},
{name: 'discount', mapping: 'discount', type: 'string'}
],
storeId : 'available_products',
proxy : {
type : 'ajax',
actionMethods : 'POST',
url : 'http://192.168.1.6/transactions/distribution_store',
reader: {
type: 'json',
root: 'data'
}
}
});
我想向网格添加分页,但我希望像这样
首先使用 json 加载所有数据,然后在客户端对这些结果进行分页,而不发送服务器请求。
是否可以? 怎么办?
问候
I have a store like this which i used for a extjs grid
Ext.create('Ext.data.Store', {
autoLoad : true,
fields : [
{name: 'item_code', mapping: 'item_code', type: 'string'},
{name: 'quantity', mapping: 'quantity', type: 'string'},
{name: 'description', mapping: 'description', type: 'string'},
{name: 'selling_price', mapping: 'selling_price', type: 'string'},
{name: 'discount', mapping: 'discount', type: 'string'}
],
storeId : 'available_products',
proxy : {
type : 'ajax',
actionMethods : 'POST',
url : 'http://192.168.1.6/transactions/distribution_store',
reader: {
type: 'json',
root: 'data'
}
}
});
I want to add a paging to grid but i want it like this
first load all the data with json and paging those results at client side without sending server requests.
is it possible?
how to do this?
Regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
加载所有数据时使用
加载所有数据后,您可以利用
directFn
配置来模拟分页功能。在此处查看我的答案< /a> 了解更多信息。也可以查看此演示。更新
directFn
解决方案对我来说总是像是一个黑客。从 4.0.7 开始,无需使用directFn
。而是使用 Ext.ux.data.PagingMemoryProxy 。演示位于此处For loading all data use
When all data is loaded you can utilize
directFn
config for emulating paging functionality. Check out my answer here for more info. And check out this demo too.UPDATE
directFn
solution always seemed like a hack to me. Since 4.0.7 there is no need to usedirectFn
. Instead use Ext.ux.data.PagingMemoryProxy. The demo is here