Commit f5ed8bb281e316c979b18b8b54b16ad0093ba420

Authored by Erdogan Furkan
1 parent 0e72eb4c

#9505 - Added duration save to catalogs

Showing 2 changed files with 19 additions and 7 deletions   Show diff stats
js/app/AmdaApp.js
... ... @@ -191,6 +191,9 @@ Ext.define('amdaApp.AmdaApp', {
191 191  
192 192 // TT duration management
193 193 Ext.state.Manager.getProvider().set('tt_duration', 3);
  194 +
  195 + // Cat duration management
  196 + Ext.state.Manager.getProvider().set('cat_duration', 3);
194 197  
195 198 // now ready...
196 199 //override createWindow method of desktop
... ...
js/app/views/CatalogUI.js
... ... @@ -19,7 +19,8 @@ Ext.define('amdaUI.CatalogUI', {
19 19 'Ext.ux.grid.filter.StringFilter',
20 20 'amdaUI.OperationsTT',
21 21 'Ext.grid.plugin.BufferedRenderer',
22   - 'amdaUI.StatisticalPlug'
  22 + 'amdaUI.StatisticalPlug',
  23 ++ 'amdaDesktop.AmdaStateProvider'
23 24 ],
24 25  
25 26 isCatalog: true,
... ... @@ -50,7 +51,7 @@ Ext.define('amdaUI.CatalogUI', {
50 51  
51 52 Ext.Array.each(this.TTGrid.headerCt.getGridColumns(), function (item, index, all) {
52 53 // if item is the default duration column
53   - if (item.id == amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2') {
  54 + if (item.id == amdaUI.CatalogUI.COL_TO_HIDE_DURATION + Ext.state.Manager.getProvider().get('cat_duration').toString()) {
54 55 // show this column
55 56 item.show();
56 57 }
... ... @@ -362,7 +363,7 @@ Ext.define('amdaUI.CatalogUI', {
362 363 width: 120,
363 364 minWidth: 50,
364 365 menuDisabled: false,
365   - hidden: true,
  366 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 1 ? true : false,
366 367 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '1',
367 368 renderer: function (value) {
368 369 return this.dateToString(value);
... ... @@ -382,7 +383,7 @@ Ext.define('amdaUI.CatalogUI', {
382 383 width: 120,
383 384 minWidth: 50,
384 385 menuDisabled: false,
385   - hidden: true,
  386 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 2 ? true : false,
386 387 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2',
387 388 renderer: function (value) {
388 389 return this.dateToString(value);
... ... @@ -402,7 +403,7 @@ Ext.define('amdaUI.CatalogUI', {
402 403 width: 120,
403 404 minWidth: 50,
404 405 menuDisabled: false,
405   - hidden: false,
  406 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 3 ? true : false,
406 407 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '3',
407 408 renderer: function (value) {
408 409 return this.dateToString(value);
... ... @@ -422,7 +423,7 @@ Ext.define('amdaUI.CatalogUI', {
422 423 width: 120,
423 424 minWidth: 50,
424 425 menuDisabled: false,
425   - hidden: true,
  426 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 4 ? true : false,
426 427 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '4',
427 428 renderer: function (value) {
428 429 return Ext.util.Format.number(value, '0.000');
... ... @@ -1191,7 +1192,15 @@ Ext.define('amdaUI.CatalogUI', {
1191 1192 });
1192 1193 }, this);
1193 1194 },
1194   - scope: this
  1195 + scope: this,
  1196 + columnschanged:function(ct,eOpts){ // Takes into count the duration changes
  1197 + Ext.Array.each(ct.getGridColumns(), function (item, index, all) {
  1198 + if (Ext.util.Format.substr(item.id, 0, amdaUI.CatalogUI.COL_TO_HIDE_DURATION.length) == amdaUI.CatalogUI.COL_TO_HIDE_DURATION && !item.isHidden()) {
  1199 + var durationNumber = parseInt(Ext.util.Format.substr(item.id, amdaUI.CatalogUI.COL_TO_HIDE_DURATION.length, amdaUI.CatalogUI.COL_TO_HIDE_DURATION.length+1));
  1200 + Ext.state.Manager.getProvider().set('cat_duration', durationNumber);
  1201 + }
  1202 + });
  1203 + }
1195 1204 },
1196 1205 dockedItems: [{
1197 1206 xtype: 'toolbar',
... ...