Commit dc702c6dcd9c6be7d68a27a1239f9b460e57d130

Authored by Elena.Budnik
1 parent 6b5180de

sort without save

Showing 1 changed file with 49 additions and 39 deletions   Show diff stats
js/app/views/CatalogUI.js
... ... @@ -172,21 +172,21 @@ Ext.define('amdaUI.CatalogUI', {
172 172 me.updateCount();
173 173 //Statistical plugin
174 174 // this.fireEvent("refresh");
175   - }
  175 + }
176 176 }
177   - });
  177 + });
178 178  
179 179 me.TTGrid.reconfigure(store, columns);
180   - }
  180 + }
181 181 me.TTGrid.getSelectionModel().deselectAll();
182 182 //
183 183 // // clear filters
184 184 // me.TTGrid.getStore().clearFilter(true);
185 185 //
186   - // //clear sort
187   - // me.TTGrid.getStore().sorters.clear();
188   - // //me.TTGrid.getStore().sorters = new Ext.util.MixedCollection();
189   -
  186 + // clear sort
  187 + me.TTGrid.getStore().sorters.clear();
  188 + // me.TTGrid.getStore().sorters = new Ext.util.MixedCollection();
  189 +
190 190 //set cache token to the Catalog object
191 191 me.object.set('cacheToken', result.token);
192 192 me.setParamInfo(result.parameters);
... ... @@ -342,33 +342,38 @@ Ext.define('amdaUI.CatalogUI', {
342 342 // Only update the record if the new value is different than the
343 343 // startValue. When the view refreshes its el will gain focus
344 344 if (!record.isEqual(value, startValue)) {
345   - var obj = {};
346   -
347   - obj['cacheId'] = record.get('cacheId');
348   - obj['isCatalog'] = true;
349   - obj[activeColumn.dataIndex] = value;
350   -
351   - //Interval is modified on the server side
352   - me.editing = true;
353   -
354   - AmdaAction.modifyTTCacheInterval(obj, function (result, e) {
355   - var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id);
356   - if (module)
357   - module.getUiContent().status = result.status;
358   - context.grid.getSelectionModel().deselectAll();
359   - context.store.reload({
360   - callback : function(records, options, success) {
361   - context.view.bufferedRenderer.scrollTo(context.rowIdx, true, function() {
362   - me.fireEvent('edit', me, context);
363   - me.editing = false;
364   - }, me);
  345 + var obj = {};
  346 +
  347 + obj['cacheId'] = record.get('cacheId');
  348 + obj['isCatalog'] = true;
  349 + obj[activeColumn.dataIndex] = value;
  350 +
  351 + //Interval is modified on the server side
  352 + me.editing = true;
  353 +
  354 + AmdaAction.modifyTTCacheInterval(obj, function (result, e) {
  355 + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id);
  356 + if (module)
  357 + module.getUiContent().status = result.status;
  358 + if (!context.store.loading) {
  359 + context.grid.getSelectionModel().deselectAll();
  360 + context.store.reload({
  361 + callback : function(records, options, success) {
  362 + context.view.bufferedRenderer.scrollTo(context.rowIdx, true, function() {
  363 + me.fireEvent('edit', me, context);
  364 + me.editing = false;
  365 + }, me);
  366 + }
  367 + });
  368 + }
  369 + else {
  370 + me.editing = false;
365 371 }
366   - });
367 372 }, this);
368 373 }
369 374 else
370 375 me.editing = false;
371   - }
  376 + }
372 377 }
373 378 });
374 379  
... ... @@ -376,7 +381,8 @@ Ext.define('amdaUI.CatalogUI', {
376 381 height: 530,
377 382 columns: [ ],
378 383 frame: true,
379   - columnLines: true,
  384 + columnLines: true,
  385 + selModel: {pruneRemoved: false},
380 386 // selType: 'cellmodel',
381 387 plugins: [ cellEditing, { ptype : 'bufferedrenderer'} ],
382 388 dockedItems: [{
... ... @@ -397,14 +403,16 @@ Ext.define('amdaUI.CatalogUI', {
397 403 var me = this;
398 404 AmdaAction.addTTCacheInterval({'index' : row, 'isCatalog' : true}, function (result, e) {
399 405 this.status = result.status;
400   - this.TTGrid.getStore().reload({
401   - callback : function(records, options, success) {
402   - me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() {
403   - me.TTGrid.getView().select(row);
404   - cellEditing.startEditByPosition({row: row, column: 1});
405   - }, me);
406   - }
407   - });
  406 + if (!this.TTGrid.getStore().loading) {
  407 + this.TTGrid.getStore().reload({
  408 + callback : function(records, options, success) {
  409 + me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() {
  410 + me.TTGrid.getView().select(row);
  411 + cellEditing.startEditByPosition({row: row, column: 1});
  412 + }, me);
  413 + }
  414 + });
  415 + }
408 416 }, this);
409 417 }
410 418 },{
... ... @@ -420,7 +428,9 @@ Ext.define('amdaUI.CatalogUI', {
420 428 this.TTGrid.getSelectionModel().deselectAll();
421 429 AmdaAction.removeTTCacheIntervalFromId(rowId, this.isCatalog, function (result, e) {
422 430 this.status = result.status;
423   - this.TTGrid.getStore().reload();
  431 + if (!this.TTGrid.getStore().loading) {
  432 + this.TTGrid.getStore().reload();
  433 + }
424 434 }, this);
425 435 }
426 436 }
... ...