From dc702c6dcd9c6be7d68a27a1239f9b460e57d130 Mon Sep 17 00:00:00 2001 From: Elena.Budnik Date: Wed, 31 Oct 2018 17:35:16 +0100 Subject: [PATCH] sort without save --- js/app/views/CatalogUI.js | 88 +++++++++++++++++++++++++++++++++++++++++++++++++--------------------------------------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/js/app/views/CatalogUI.js b/js/app/views/CatalogUI.js index 622cf3e..7b294ca 100644 --- a/js/app/views/CatalogUI.js +++ b/js/app/views/CatalogUI.js @@ -172,21 +172,21 @@ Ext.define('amdaUI.CatalogUI', { me.updateCount(); //Statistical plugin // this.fireEvent("refresh"); - } + } } - }); + }); me.TTGrid.reconfigure(store, columns); - } + } me.TTGrid.getSelectionModel().deselectAll(); // // // clear filters // me.TTGrid.getStore().clearFilter(true); // - // //clear sort - // me.TTGrid.getStore().sorters.clear(); - // //me.TTGrid.getStore().sorters = new Ext.util.MixedCollection(); - + // clear sort + me.TTGrid.getStore().sorters.clear(); + // me.TTGrid.getStore().sorters = new Ext.util.MixedCollection(); + //set cache token to the Catalog object me.object.set('cacheToken', result.token); me.setParamInfo(result.parameters); @@ -342,33 +342,38 @@ Ext.define('amdaUI.CatalogUI', { // Only update the record if the new value is different than the // startValue. When the view refreshes its el will gain focus if (!record.isEqual(value, startValue)) { - var obj = {}; - - obj['cacheId'] = record.get('cacheId'); - obj['isCatalog'] = true; - obj[activeColumn.dataIndex] = value; - - //Interval is modified on the server side - me.editing = true; - - AmdaAction.modifyTTCacheInterval(obj, function (result, e) { - var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id); - if (module) - module.getUiContent().status = result.status; - context.grid.getSelectionModel().deselectAll(); - context.store.reload({ - callback : function(records, options, success) { - context.view.bufferedRenderer.scrollTo(context.rowIdx, true, function() { - me.fireEvent('edit', me, context); - me.editing = false; - }, me); + var obj = {}; + + obj['cacheId'] = record.get('cacheId'); + obj['isCatalog'] = true; + obj[activeColumn.dataIndex] = value; + + //Interval is modified on the server side + me.editing = true; + + AmdaAction.modifyTTCacheInterval(obj, function (result, e) { + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id); + if (module) + module.getUiContent().status = result.status; + if (!context.store.loading) { + context.grid.getSelectionModel().deselectAll(); + context.store.reload({ + callback : function(records, options, success) { + context.view.bufferedRenderer.scrollTo(context.rowIdx, true, function() { + me.fireEvent('edit', me, context); + me.editing = false; + }, me); + } + }); + } + else { + me.editing = false; } - }); }, this); } else me.editing = false; - } + } } }); @@ -376,7 +381,8 @@ Ext.define('amdaUI.CatalogUI', { height: 530, columns: [ ], frame: true, - columnLines: true, + columnLines: true, + selModel: {pruneRemoved: false}, // selType: 'cellmodel', plugins: [ cellEditing, { ptype : 'bufferedrenderer'} ], dockedItems: [{ @@ -397,14 +403,16 @@ Ext.define('amdaUI.CatalogUI', { var me = this; AmdaAction.addTTCacheInterval({'index' : row, 'isCatalog' : true}, function (result, e) { this.status = result.status; - this.TTGrid.getStore().reload({ - callback : function(records, options, success) { - me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() { - me.TTGrid.getView().select(row); - cellEditing.startEditByPosition({row: row, column: 1}); - }, me); - } - }); + if (!this.TTGrid.getStore().loading) { + this.TTGrid.getStore().reload({ + callback : function(records, options, success) { + me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() { + me.TTGrid.getView().select(row); + cellEditing.startEditByPosition({row: row, column: 1}); + }, me); + } + }); + } }, this); } },{ @@ -420,7 +428,9 @@ Ext.define('amdaUI.CatalogUI', { this.TTGrid.getSelectionModel().deselectAll(); AmdaAction.removeTTCacheIntervalFromId(rowId, this.isCatalog, function (result, e) { this.status = result.status; - this.TTGrid.getStore().reload(); + if (!this.TTGrid.getStore().loading) { + this.TTGrid.getStore().reload(); + } }, this); } } -- libgit2 0.21.2