我想爲通過Web服務接收數據的網格面板進行客戶端分頁,但我不知道如何繼續此操作。ExtJS 4.2網格分頁
這是我的代碼到目前爲止。分頁工具欄顯示正確的頁數,但是,所有結果都顯示在第一頁。往前走,回到頁面沒有任何區別。
型號
Ext.define('MCS.model.task.myModel', {
extend: 'Ext.data.Model',
fields:
[
{ name: 'Case_ID', type : 'Auto' },
{ name: 'BP_Name', type : 'Auto' },
{ name: 'Project', type : 'Auto' }
],
proxy:
{
type: 'ajax',
url: '/Service/Task?type=mytasks',
reader:
{
type: 'json',
root: 'data'
},
},
});
商店
Ext.define('MCS.store.task.myStore', {
extend: 'Ext.data.Store',
requires: 'MCS.model.task.myModel',
model: 'MCS.model.task.myModel',
pageSize : 10,
autoLoad: true
});
的GridPanel
Ext.define('MCS.view.task.myGrid', {
extend: 'Ext.grid.Panel',
alias: 'widget.myGrid',
store: 'task.myStore',
columns: [],
dockedItems:
[
{ xtype: 'myToolbar',
dock: 'top',
},
{ xtype: 'pagingtoolbar',
dock: 'bottom',
displayMsg: '{0} - {1} of {2}',
emptyMsg: 'No data to display',
store: 'task.myStore'
}
],
initComponent: function()
{
this.columns =
[
{ text: 'Case ID', dataIndex: 'Case_ID' },
{ text: 'Business Partner Name', dataIndex: 'BP_Name' },
{ text: 'Project', dataIndex: 'Project' }
];
this.callParent();
}
});
這可能會幫助你解決這個問題。請參閱接受的答案。 http://stackoverflow.com/questions/42650224/pagesize-not-working-on-grid-in-extjs – 2017-03-13 09:56:06