Commit a5da368dc5531c8e4121a34198d5c0e33abb60b4

Authored by Erdogan Furkan
1 parent 79dd62c6

#9505 - Done

Showing 2 changed files with 19 additions and 6 deletions   Show diff stats
js/app/AmdaApp.js
... ... @@ -188,6 +188,9 @@ Ext.define('amdaApp.AmdaApp', {
188 188 {
189 189 // custom logic before getXYZ methods get called...
190 190 this.callParent();
  191 +
  192 + // TT duration management
  193 + Ext.state.Manager.getProvider().set('tt_duration', 4);
191 194  
192 195 // now ready...
193 196 //override createWindow method of desktop
... ...
js/app/views/TimeTableUI.js
... ... @@ -18,7 +18,8 @@ Ext.define('amdaUI.TimeTableUI', {
18 18 'Ext.ux.grid.filter.NumericFilter',
19 19 'amdaUI.OperationsTT',
20 20 'amdaUI.StatisticalPlug',
21   - 'Ext.grid.plugin.BufferedRenderer'
  21 + 'Ext.grid.plugin.BufferedRenderer',
  22 + 'amdaDesktop.AmdaStateProvider'
22 23 ],
23 24  
24 25 statics: {
... ... @@ -51,7 +52,7 @@ Ext.define('amdaUI.TimeTableUI', {
51 52  
52 53 Ext.Array.each(this.TTGrid.headerCt.getGridColumns(), function (item, index, all) {
53 54 // if item is the default duration column
54   - if (item.id == amdaUI.TimeTableUI.COL_TO_HIDE + '2') {
  55 + if (item.id == amdaUI.TimeTableUI.COL_TO_HIDE + Ext.state.Manager.getProvider().get('tt_duration').toString()) {
55 56 // show this column
56 57 item.show();
57 58 }
... ... @@ -578,6 +579,7 @@ Ext.define('amdaUI.TimeTableUI', {
578 579 store: store,
579 580 features: [filters],
580 581 columnLines: true,
  582 + me:this,
581 583 selModel: {pruneRemoved: false},
582 584  
583 585 countDecimals: function (value) {
... ... @@ -643,7 +645,7 @@ Ext.define('amdaUI.TimeTableUI', {
643 645 {
644 646 header: 'Duration (day)', width: 120, dataIndex: 'durationDay',
645 647 id: amdaUI.TimeTableUI.COL_TO_HIDE + '1',
646   - hidden: true,
  648 + hidden: Ext.state.Manager.getProvider().get('tt_duration') != 1 ? true : false,
647 649 renderer: function (value) {
648 650 return this.dateToString(value);
649 651 },
... ... @@ -665,7 +667,7 @@ Ext.define('amdaUI.TimeTableUI', {
665 667 {
666 668 header: 'Duration (hour)', width: 120, dataIndex: 'durationHour',
667 669 id: amdaUI.TimeTableUI.COL_TO_HIDE + '2',
668   - hidden: true,
  670 + hidden: Ext.state.Manager.getProvider().get('tt_duration') != 2 ? true : false,
669 671 renderer: function (value) {
670 672 return this.dateToString(value);
671 673 },
... ... @@ -686,6 +688,7 @@ Ext.define('amdaUI.TimeTableUI', {
686 688 },
687 689 {
688 690 header: 'Duration (min)', width: 120, dataIndex: 'durationMin',
  691 + hidden:Ext.state.Manager.getProvider().get('tt_duration') != 3 ? true : false,
689 692 id: amdaUI.TimeTableUI.COL_TO_HIDE + '3',
690 693 renderer: function (value) {
691 694 return this.dateToString(value);
... ... @@ -708,7 +711,7 @@ Ext.define('amdaUI.TimeTableUI', {
708 711 {
709 712 header: 'Duration (sec)', width: 120, dataIndex: 'durationSec',
710 713 id: amdaUI.TimeTableUI.COL_TO_HIDE + '4',
711   - hidden: true,
  714 + hidden:Ext.state.Manager.getProvider().get('tt_duration') != 4 ? true : false,
712 715 renderer: function (value) {
713 716 return Ext.util.Format.number(value, '0.000');
714 717 },
... ... @@ -800,8 +803,15 @@ Ext.define('amdaUI.TimeTableUI', {
800 803 // send refresh event to statistical plugin
801 804 this.fireEvent("refresh");
802 805 }
  806 + },
  807 + columnschanged:function(ct,eOpts){ // Takes into count the duration changes
  808 + Ext.Array.each(ct.getGridColumns(), function (item, index, all) {
  809 + if (Ext.util.Format.substr(item.id, 0, amdaUI.TimeTableUI.COL_TO_HIDE.length) == amdaUI.TimeTableUI.COL_TO_HIDE && !item.isHidden()) {
  810 + var durationNumber = parseInt(Ext.util.Format.substr(item.id, amdaUI.TimeTableUI.COL_TO_HIDE.length, amdaUI.TimeTableUI.COL_TO_HIDE.length+1));
  811 + Ext.state.Manager.getProvider().set('tt_duration', durationNumber);
  812 + }
  813 + });
803 814 }
804   -
805 815 }
806 816 });
807 817  
... ...