[英]How to add paging to extjs 4 grid?
我有一個這樣的商店,我用於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
config來模擬分頁功能。 看看我的答案在這里獲得更多信息。 並查看此演示 。
該解決方案不適用於ext js 4.1.1。 你能提供這個版本的例子嗎?
也不適用於ExtJS 4.2。
directFn
解決方案對我來說似乎總是很directFn
。 從4.0.7開始,不需要使用directFn
。 而是使用Ext.ux.data.PagingMemoryProxy 。 演示就在這里
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.