diff --git a/js/app/AmdaApp.js b/js/app/AmdaApp.js index fc858d0..9dcabfd 100755 --- a/js/app/AmdaApp.js +++ b/js/app/AmdaApp.js @@ -188,6 +188,9 @@ Ext.define('amdaApp.AmdaApp', { { // custom logic before getXYZ methods get called... this.callParent(); + + // TT duration management + Ext.state.Manager.getProvider().set('tt_duration', 4); // now ready... //override createWindow method of desktop diff --git a/js/app/views/TimeTableUI.js b/js/app/views/TimeTableUI.js index 112a731..f1ded07 100755 --- a/js/app/views/TimeTableUI.js +++ b/js/app/views/TimeTableUI.js @@ -18,7 +18,8 @@ Ext.define('amdaUI.TimeTableUI', { 'Ext.ux.grid.filter.NumericFilter', 'amdaUI.OperationsTT', 'amdaUI.StatisticalPlug', - 'Ext.grid.plugin.BufferedRenderer' + 'Ext.grid.plugin.BufferedRenderer', + 'amdaDesktop.AmdaStateProvider' ], statics: { @@ -51,7 +52,7 @@ Ext.define('amdaUI.TimeTableUI', { Ext.Array.each(this.TTGrid.headerCt.getGridColumns(), function (item, index, all) { // if item is the default duration column - if (item.id == amdaUI.TimeTableUI.COL_TO_HIDE + '2') { + if (item.id == amdaUI.TimeTableUI.COL_TO_HIDE + Ext.state.Manager.getProvider().get('tt_duration').toString()) { // show this column item.show(); } @@ -578,6 +579,7 @@ Ext.define('amdaUI.TimeTableUI', { store: store, features: [filters], columnLines: true, + me:this, selModel: {pruneRemoved: false}, countDecimals: function (value) { @@ -643,7 +645,7 @@ Ext.define('amdaUI.TimeTableUI', { { header: 'Duration (day)', width: 120, dataIndex: 'durationDay', id: amdaUI.TimeTableUI.COL_TO_HIDE + '1', - hidden: true, + hidden: Ext.state.Manager.getProvider().get('tt_duration') != 1 ? true : false, renderer: function (value) { return this.dateToString(value); }, @@ -665,7 +667,7 @@ Ext.define('amdaUI.TimeTableUI', { { header: 'Duration (hour)', width: 120, dataIndex: 'durationHour', id: amdaUI.TimeTableUI.COL_TO_HIDE + '2', - hidden: true, + hidden: Ext.state.Manager.getProvider().get('tt_duration') != 2 ? true : false, renderer: function (value) { return this.dateToString(value); }, @@ -686,6 +688,7 @@ Ext.define('amdaUI.TimeTableUI', { }, { header: 'Duration (min)', width: 120, dataIndex: 'durationMin', + hidden:Ext.state.Manager.getProvider().get('tt_duration') != 3 ? true : false, id: amdaUI.TimeTableUI.COL_TO_HIDE + '3', renderer: function (value) { return this.dateToString(value); @@ -708,7 +711,7 @@ Ext.define('amdaUI.TimeTableUI', { { header: 'Duration (sec)', width: 120, dataIndex: 'durationSec', id: amdaUI.TimeTableUI.COL_TO_HIDE + '4', - hidden: true, + hidden:Ext.state.Manager.getProvider().get('tt_duration') != 4 ? true : false, renderer: function (value) { return Ext.util.Format.number(value, '0.000'); }, @@ -800,8 +803,15 @@ Ext.define('amdaUI.TimeTableUI', { // send refresh event to statistical plugin this.fireEvent("refresh"); } + }, + columnschanged:function(ct,eOpts){ // Takes into count the duration changes + Ext.Array.each(ct.getGridColumns(), function (item, index, all) { + if (Ext.util.Format.substr(item.id, 0, amdaUI.TimeTableUI.COL_TO_HIDE.length) == amdaUI.TimeTableUI.COL_TO_HIDE && !item.isHidden()) { + var durationNumber = parseInt(Ext.util.Format.substr(item.id, amdaUI.TimeTableUI.COL_TO_HIDE.length, amdaUI.TimeTableUI.COL_TO_HIDE.length+1)); + Ext.state.Manager.getProvider().set('tt_duration', durationNumber); + } + }); } - } }); -- libgit2 0.21.2