我有一个这样的商店,我用它来一个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加载所有数据,然后在不发送服务器请求的情况下在客户端分页这些结果.
可能吗?
这个怎么做?
问候
解决方法:
用于加载所有数据
var myData = [];
Ext.Ajax.request({
url: 'http://192.168.1.6/transactions/distribution_store',
method: 'POST',
success: function(response){
myData = Ext.decode(response.responseText);
}
});
加载完所有数据后,您可以利用directFn配置来模拟分页功能.查看我的答案here以获取更多信息.并也签出this demo.
更新
the solution doesn’t work for ext js 4.1.1 . Can u provide an example for this version?
Doesn’t work for ExtJS 4.2 either.
对我来说,directFn解决方案始终像是一个hack.从4.0.7版本开始,无需使用directFn.而是使用Ext.ux.data.PagingMemoryProxy.演示为here
原文地址:https://codeday.me/bug/20191102/1989761.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。