我正在尝试在现有工具栏中添加一个分页工具栏,并使用以下代码隐藏第一个、上一个、下一个、最后一个和刷新按钮。我的问题是我无法获取正确的 afterPageText 值(总页数)。我正在为 xCP Designer 中的结果列表执行此操作。请帮忙。
代码:
Ext.define('Override.toolbar.Paging', {
override: 'Ext.toolbar.Paging',
hideFirstButton: false,
hidePrevButton: false,
hideBeforePageText: false,
hidePageNumberField: false,
hideAfterPageText: false,
hideNextButton: false,
hideLastButton: false,
hideRefreshButton: false,
getPagingItems: function() {
var me = this;
return [{
itemId: 'first',
tooltip: me.firstText,
overflowText: me.firstText,
iconCls: Ext.baseCSSPrefix + 'tbar-page-first',
hidden: me.hideFirstButton,
disabled: true,
handler: me.moveFirst,
scope: me
}, {
itemId: 'prev',
tooltip: me.prevText,
overflowText: me.prevText,
iconCls: Ext.baseCSSPrefix + 'tbar-page-prev',
hidden: me.hidePrevButton,
disabled: true,
handler: me.movePrevious,
scope: me
}, {
xtype: 'tbseparator',
hidden: me.hideFirstButton && me.hidePrevButton
}, {
xtype: 'tbtext',
text: me.beforePageText,
hidden: me.hideBeforePageText
}, {
xtype: 'numberfield',
itemId: 'inputItem',
name: 'inputItem',
hidden: me.hidePageNumberField,
cls: Ext.baseCSSPrefix + 'tbar-page-number',
allowDecimals: false,
minValue: 1,
hideTrigger: true,
enableKeyEvents: true,
keyNavEnabled: false,
selectOnFocus: true,
submitValue: false,
isFormField: false,
width: me.inputItemWidth,
margins: '-1 2 3 2',
listeners: {
scope: me,
keydown: me.onPagingKeyDown,
blur: me.onPagingBlur
}
}, {
xtype: 'tbtext',
itemId: 'afterTextItem',
hidden: me.hideAfterPageText,
text: "of {0}"
}, {
xtype: 'tbseparator',
hidden: me.hideNextButton && me.hideLastButton
}, {
itemId: 'next',
tooltip: me.nextText,
overflowText: me.nextText,
iconCls: Ext.baseCSSPrefix + 'tbar-page-next',
hidden: me.hideNextButton,
disabled: true,
handler: me.moveNext,
scope: me
}, {
itemId: 'last',
tooltip: me.lastText,
overflowText: me.lastText,
iconCls: Ext.baseCSSPrefix + 'tbar-page-last',
hidden: me.hideLastButton,
disabled: true,
handler: me.moveLast,
scope: me
}, {
xtype: 'tbseparator',
hidden: me.hideRefreshButton
}, {
itemId: 'refresh',
hidden: me.hideRefreshButton,
tooltip: me.refreshText,
overflowText: me.refreshText,
iconCls: Ext.baseCSSPrefix + 'tbar-loading',
handler: me.doRefresh,
scope: me
}];
}
});
xcp.widget.grid.ResultsListGrid.override({
initComponent: function () {
var me = this;
this.dockedItems = [
{
xtype: 'toolbar',
//store: me.store,
dock: 'bottom',
height: '45px',
items: [
//'->',//right alight the button
{
xtype: 'xcp_pagingtoolbar',
store: me.store,
//flex: true,
dock: 'bottom',
displayInfo: true
},'->',
{
xtype: 'pagingtoolbar',
store: me.store,
displayInfo: false,
hideRefreshButton: true,
hideFirstButton: true,
hideLastButton: true,
hidePrevButton: true,
hideNextButton: true,
//disabled: true
}
]
},
];
this.callParent();
}
}
);
谢谢。-SS