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,6 +191,9 @@ Ext.define('amdaApp.AmdaApp', {
191 191
192 // TT duration management 192 // TT duration management
193 Ext.state.Manager.getProvider().set('tt_duration', 3); 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 // now ready... 198 // now ready...
196 //override createWindow method of desktop 199 //override createWindow method of desktop
js/app/views/CatalogUI.js
@@ -19,7 +19,8 @@ Ext.define('amdaUI.CatalogUI', { @@ -19,7 +19,8 @@ Ext.define('amdaUI.CatalogUI', {
19 'Ext.ux.grid.filter.StringFilter', 19 'Ext.ux.grid.filter.StringFilter',
20 'amdaUI.OperationsTT', 20 'amdaUI.OperationsTT',
21 'Ext.grid.plugin.BufferedRenderer', 21 'Ext.grid.plugin.BufferedRenderer',
22 - 'amdaUI.StatisticalPlug' 22 + 'amdaUI.StatisticalPlug',
  23 ++ 'amdaDesktop.AmdaStateProvider'
23 ], 24 ],
24 25
25 isCatalog: true, 26 isCatalog: true,
@@ -50,7 +51,7 @@ Ext.define('amdaUI.CatalogUI', { @@ -50,7 +51,7 @@ Ext.define('amdaUI.CatalogUI', {
50 51
51 Ext.Array.each(this.TTGrid.headerCt.getGridColumns(), function (item, index, all) { 52 Ext.Array.each(this.TTGrid.headerCt.getGridColumns(), function (item, index, all) {
52 // if item is the default duration column 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 // show this column 55 // show this column
55 item.show(); 56 item.show();
56 } 57 }
@@ -362,7 +363,7 @@ Ext.define('amdaUI.CatalogUI', { @@ -362,7 +363,7 @@ Ext.define('amdaUI.CatalogUI', {
362 width: 120, 363 width: 120,
363 minWidth: 50, 364 minWidth: 50,
364 menuDisabled: false, 365 menuDisabled: false,
365 - hidden: true, 366 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 1 ? true : false,
366 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '1', 367 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '1',
367 renderer: function (value) { 368 renderer: function (value) {
368 return this.dateToString(value); 369 return this.dateToString(value);
@@ -382,7 +383,7 @@ Ext.define('amdaUI.CatalogUI', { @@ -382,7 +383,7 @@ Ext.define('amdaUI.CatalogUI', {
382 width: 120, 383 width: 120,
383 minWidth: 50, 384 minWidth: 50,
384 menuDisabled: false, 385 menuDisabled: false,
385 - hidden: true, 386 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 2 ? true : false,
386 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2', 387 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '2',
387 renderer: function (value) { 388 renderer: function (value) {
388 return this.dateToString(value); 389 return this.dateToString(value);
@@ -402,7 +403,7 @@ Ext.define('amdaUI.CatalogUI', { @@ -402,7 +403,7 @@ Ext.define('amdaUI.CatalogUI', {
402 width: 120, 403 width: 120,
403 minWidth: 50, 404 minWidth: 50,
404 menuDisabled: false, 405 menuDisabled: false,
405 - hidden: false, 406 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 3 ? true : false,
406 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '3', 407 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '3',
407 renderer: function (value) { 408 renderer: function (value) {
408 return this.dateToString(value); 409 return this.dateToString(value);
@@ -422,7 +423,7 @@ Ext.define('amdaUI.CatalogUI', { @@ -422,7 +423,7 @@ Ext.define('amdaUI.CatalogUI', {
422 width: 120, 423 width: 120,
423 minWidth: 50, 424 minWidth: 50,
424 menuDisabled: false, 425 menuDisabled: false,
425 - hidden: true, 426 + hidden: Ext.state.Manager.getProvider().get('cat_duration') != 4 ? true : false,
426 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '4', 427 id: amdaUI.CatalogUI.COL_TO_HIDE_DURATION + '4',
427 renderer: function (value) { 428 renderer: function (value) {
428 return Ext.util.Format.number(value, '0.000'); 429 return Ext.util.Format.number(value, '0.000');
@@ -1191,7 +1192,15 @@ Ext.define('amdaUI.CatalogUI', { @@ -1191,7 +1192,15 @@ Ext.define('amdaUI.CatalogUI', {
1191 }); 1192 });
1192 }, this); 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 dockedItems: [{ 1205 dockedItems: [{
1197 xtype: 'toolbar', 1206 xtype: 'toolbar',