我想实现分页,即onclick(切换)按钮,网格应该在单页中加载整个数据并且按钮实现分页的onclick(切换)(即pagesize of 25)。 我们怎样才能实现这个功能? 提前致谢
以下是无效的代码。是否有任何变化要实施? 这是商店:
var Store = Ext.create('Ext.data.Store', {
remoteSort : true,
autoSave: false,
fields: data,
pageSize: 20,
remoteFilter:true,
sortInfo:{field: 'ORDER_ID', direction: "DESC"},
proxy: {
type: 'ajax',
url : url,
reader: {
type: 'json',
rootProperty: 'data',
totalProperty: 'total'
}
},
listeners: {
load : function(store, records, options) {
//index = options.params.start; // need to work here to get index
if (store.getCount() == 0) {
Ext.Msg.alert("No View Sales History Data Loaded", "please clear current filter(s)"); // <-- show load-feedback for suceess conditions
} else {
Ext.Msg.alert("View Sales History Data Loaded", "" + store.getCount() + " of " + store.getTotalCount() + " record(s)");
}
if (pagingtoolBar.pageSize != maxPageSize) {
Ext.getCmp('pageSizeMaxButton').show();
Ext.getCmp('pageSizeMinButton').hide();
}
if (window.top && window.top.footer) window.top.footer.ResetTimer();
},
exception : function(proxy, type, action, options, res) {
progressWindow.hide();
}
}
}
以下是寻呼工具栏:
{
text: 'Multi Page', //toggle button in toolbar
tooltip: 'Switch to single-page view',
iconCls: 'silk-pageSize',
id: 'pageSizeMaxButton',
hidden: false,
handler: function () {
if (viewSalesHistoryWindow != undefined) viewSalesHistoryWindow.close();
pagingtoolbar.pageSize = maxPageSize;
Ext.getCmp('pageSizeMinButton').show();
this.hide();
//pagingtoolbar.changePage(1);
//pagingtoolbar.change; // changePAge is not available in Extjs6
//filters.local = true;
vshStore.remoteSort = false;
},
{
text: 'Single Page',// toggle button in toolbar
tooltip: 'Switch to multi-page view',
iconCls: 'silk-pageSize',
id: 'pageSizeMinButton',
hidden: true,
handler: function () {
if (viewSalesHistoryWindow != undefined) viewSalesHistoryWindow.close();
// set page size
pagingtoolbar.pageSize = originalPageSize;
// toggle buttons
Ext.getCmp('pageSizeMaxButton').show();
this.hide();
// switch to page 1
//pagingtoolbar.changePage(1);
//pagingtoolbar.change; // changePAge is not available in Extjs6
//filters.local = false;
vshStore.remoteSort = true;
}
}
答案 0 :(得分:0)