123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- Ext.define('uas.view.trigger.MultiDbfindPaging', {
- extend: 'Ext.toolbar.Paging',
- xtype: 'multidbfindPaging',
- cls:'x-dataListPaging',
- height: 36,
- dock: 'bottom',
- displayInfo: false,
- emptyMsg: "无数据",
- items:[{
- xtype:'checkbox',
- cls:'x-paging-checkbox',
- name:'showSelectRecord',
- boxLabel:'已选中数据',
- handler:function(b){
- var grid = b.up('multidbfindtriggerpanel');
- if(b.checked){
- grid.store.loadData(grid.selectRecordArr);
- grid.selModel.noChange = true;
- grid.selModel.deselectAll();
- grid.selModel.select(grid.selectRecordArr);
- grid.selModel.noChange = false;
- //刷新展示数据
- var dataCount = grid.selectRecordArr.length,msg;
- var display = b.ownerCt.child('#displayItem');
- if (dataCount === 0) {
- msg = b.ownerCt.emptyMsg;
- } else {
- msg = Ext.String.format(
- b.ownerCt.displayMsg,
- 1,
- dataCount,
- dataCount
- );
- }
- display.setText(msg);
- b.ownerCt.child('#inputItem').setValue(1);
- b.ownerCt.child("#afterTextItem").setText('页,共'+dataCount+'页');
- }else{
- grid.selModel.noChange = true;
- grid.selModel.deselectAll();
- grid.selModel.select(grid.selectRecordArr);
- grid.selModel.noChange = false;
- grid.store.loadPage(1);
- }
- }
- },'->',{
- itemId: 'pageSizeItem',
- cls:'x-dl-paging-combo',
- labelWidth:60,
- width:124,
- value:10,
- labelAlgin:'right',
- xtype:'combo',
- editable:false,
- fieldLabel:'每页显示',
- store:[[
- '10',10
- ],[
- '20',20
- ],[
- '50',50
- ],[
- '100',100
- ],[
- '200',200
- ],[
- '500',500
- ],[
- '1000',1000
- ]],
- listeners:{
- change:function(me,newValue,oldValue){
- const paging = me.ownerCt;
- const grid = paging.ownerCt;
- const { store } = grid;
- const pageCountItem = paging.down('#pageCountItem');
- const dataCount = paging.down('#dataCountItem');
- if(newValue!==oldValue){
- store.setPageSize(newValue);
- pageCountItem.update(Ext.String.format(paging.afterPageText,'*'));
- dataCount.setValue("行/共*行");
- store.loadPage(1)
- }
- }
- }
- },{
- itemId: 'dataCountItem',
- cls:'x-dl-paging-display',
- xtype:'displayfield',
- value:'行/共*行'
- }],
- getPagingItems: function() {
- var me = this,
- inputListeners = {
- scope: me,
- blur: me.onPagingBlur
- };
- inputListeners[Ext.supports.SpecialKeyDownRepeat ? 'keydown' : 'keypress'] = me.onPagingKeyDown;
- return [
- {
- itemId: 'first',
- tooltip: me.firstText,
- overflowText: me.firstText,
- iconCls: Ext.baseCSSPrefix + 'tbar-page-first',
- disabled: true,
- handler: me.moveFirst,
- scope: me
- },
- {
- itemId: 'prev',
- tooltip: me.prevText,
- overflowText: me.prevText,
- iconCls: Ext.baseCSSPrefix + 'tbar-page-prev',
- disabled: true,
- handler: me.movePrevious,
- scope: me
- },
- '-',
- me.beforePageText,
- {
- xtype: 'numberfield',
- itemId: 'inputItem',
- name: 'inputItem',
- cls: Ext.baseCSSPrefix + 'tbar-page-number',
- allowDecimals: false,
- minValue: 1,
- hideTrigger: true,
- enableKeyEvents: true,
- keyNavEnabled: false,
- selectOnFocus: true,
- submitValue: false,
- // mark it as not a field so the form will not catch it when getting fields
- isFormField: false,
- width: me.inputItemWidth,
- margin: '-1 2 3 2',
- listeners: inputListeners
- },
- {
- xtype: 'tbtext',
- itemId: 'pageCountItem',
- html: Ext.String.format(me.afterPageText, '*')
- },
- '-',
- {
- itemId: 'next',
- tooltip: me.nextText,
- overflowText: me.nextText,
- iconCls: Ext.baseCSSPrefix + 'tbar-page-next',
- disabled: true,
- handler: me.moveNext,
- scope: me
- },
- {
- itemId: 'last',
- tooltip: me.lastText,
- overflowText: me.lastText,
- iconCls: Ext.baseCSSPrefix + 'tbar-page-last',
- disabled: true,
- handler: me.moveLast,
- scope: me
- },
- '-',
- {
- itemId: 'refresh',
- tooltip: me.refreshText,
- overflowText: me.refreshText,
- iconCls: Ext.baseCSSPrefix + 'tbar-loading',
- disabled: me.store.isLoading(),
- handler: me.doRefresh,
- scope: me
- }
- ];
- },
- moveLast: function() {
- var me = this,
- last = me.getPageData().pageCount;
- if(me.down('[name=showSelectRecord]').checked==false){
- if (me.fireEvent('beforechange', me, last) !== false) {
- me.store.loadPage(Number.MAX_SAFE_INTEGER);
- this.ownerCt.selModel.noChange = true;
- this.ownerCt.selModel.deselectAll();
- this.ownerCt.selModel.select(this.ownerCt.selectRecordArr);
- this.ownerCt.selModel.noChange = false;
- return true;
- }
- }
- return false;
- },
- moveFirst: function() {
- if(me.down('[name=showSelectRecord]').checked==false){
- if (this.fireEvent('beforechange', this, 1) !== false) {
- this.store.loadPage(1);
- this.ownerCt.selModel.noChange = true;
- this.ownerCt.selModel.deselectAll();
- this.ownerCt.selModel.select(this.ownerCt.selectRecordArr);
- this.ownerCt.selModel.noChange = false;
- return true;
- }
- }
- return false;
- },
- movePrevious: function() {
- var me = this,
- store = me.store,
- prev = store.currentPage - 1;
- if(me.down('[name=showSelectRecord]').checked==false){
- if (prev > 0) {
- if (me.fireEvent('beforechange', me, prev) !== false) {
- store.previousPage();
- this.ownerCt.selModel.noChange = true;
- this.ownerCt.selModel.deselectAll();
- this.ownerCt.selModel.select(this.ownerCt.selectRecordArr);
- this.ownerCt.selModel.noChange = false;
- return true;
- }
- }
- }
- return false;
- },
- moveNext: function() {
- var me = this,
- store = me.store,
- total = me.getPageData().pageCount,
- next = store.currentPage + 1;
- if(me.down('[name=showSelectRecord]').checked==false){
- if (next <= total) {
- if (me.fireEvent('beforechange', me, next) !== false) {
- store.nextPage();
- this.ownerCt.selModel.noChange = true;
- this.ownerCt.selModel.deselectAll();
- this.ownerCt.selModel.select(this.ownerCt.selectRecordArr);
- this.ownerCt.selModel.noChange = false;
- return true;
- }
- }
- }
- return false;
- },
- doRefresh: function() {
- var me = this,
- store = me.store,
- current = store.currentPage;
- if(me.down('[name=showSelectRecord]').checked==false){
- if (me.fireEvent('beforechange', me, current) !== false) {
- store.loadPage(current);
- this.ownerCt.selModel.noChange = true;
- this.ownerCt.selModel.deselectAll();
- this.ownerCt.selModel.select(this.ownerCt.selectRecordArr);
- this.ownerCt.selModel.noChange = false;
- return true;
- }
- }
- return false;
- },
- updateInfo: function() {
- var me = this,
- displayItem = me.child('#displayItem'),
- store = me.store,
- pageData = me.getPageData(),
- count, msg;
- if (displayItem) {
- count = store.getCount();
- if (count === 0) {
- msg = me.emptyMsg;
- } else {
- msg = Ext.String.format(me.displayMsg, pageData.fromRecord, pageData.toRecord, pageData.total);
- }
- displayItem.setText(msg);
- }
- }
- });
|