我有一个这样的商店,我用它来一个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
标签:extjs,extjs4,javascript 来源: https://codeday.me/bug/20191102/1989761.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。