Commit b46cfcd9234cfa7544f1613edda702df8ab83c01
Exists in
master
and in
49 other branches
Merge branch '9505' into develop
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,6 +188,9 @@ Ext.define('amdaApp.AmdaApp', { | ||
188 | { | 188 | { |
189 | // custom logic before getXYZ methods get called... | 189 | // custom logic before getXYZ methods get called... |
190 | this.callParent(); | 190 | this.callParent(); |
191 | + | ||
192 | + // TT duration management | ||
193 | + Ext.state.Manager.getProvider().set('tt_duration', 3); | ||
191 | 194 | ||
192 | // now ready... | 195 | // now ready... |
193 | //override createWindow method of desktop | 196 | //override createWindow method of desktop |
js/app/views/TimeTableUI.js
@@ -18,7 +18,8 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -18,7 +18,8 @@ Ext.define('amdaUI.TimeTableUI', { | ||
18 | 'Ext.ux.grid.filter.NumericFilter', | 18 | 'Ext.ux.grid.filter.NumericFilter', |
19 | 'amdaUI.OperationsTT', | 19 | 'amdaUI.OperationsTT', |
20 | 'amdaUI.StatisticalPlug', | 20 | 'amdaUI.StatisticalPlug', |
21 | - 'Ext.grid.plugin.BufferedRenderer' | 21 | + 'Ext.grid.plugin.BufferedRenderer', |
22 | + 'amdaDesktop.AmdaStateProvider' | ||
22 | ], | 23 | ], |
23 | 24 | ||
24 | statics: { | 25 | statics: { |
@@ -51,7 +52,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -51,7 +52,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
51 | 52 | ||
52 | Ext.Array.each(this.TTGrid.headerCt.getGridColumns(), function (item, index, all) { | 53 | Ext.Array.each(this.TTGrid.headerCt.getGridColumns(), function (item, index, all) { |
53 | // if item is the default duration column | 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 | // show this column | 56 | // show this column |
56 | item.show(); | 57 | item.show(); |
57 | } | 58 | } |
@@ -578,6 +579,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -578,6 +579,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
578 | store: store, | 579 | store: store, |
579 | features: [filters], | 580 | features: [filters], |
580 | columnLines: true, | 581 | columnLines: true, |
582 | + me:this, | ||
581 | selModel: {pruneRemoved: false}, | 583 | selModel: {pruneRemoved: false}, |
582 | 584 | ||
583 | countDecimals: function (value) { | 585 | countDecimals: function (value) { |
@@ -643,7 +645,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -643,7 +645,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
643 | { | 645 | { |
644 | header: 'Duration (day)', width: 120, dataIndex: 'durationDay', | 646 | header: 'Duration (day)', width: 120, dataIndex: 'durationDay', |
645 | id: amdaUI.TimeTableUI.COL_TO_HIDE + '1', | 647 | id: amdaUI.TimeTableUI.COL_TO_HIDE + '1', |
646 | - hidden: true, | 648 | + hidden: Ext.state.Manager.getProvider().get('tt_duration') != 1 ? true : false, |
647 | renderer: function (value) { | 649 | renderer: function (value) { |
648 | return this.dateToString(value); | 650 | return this.dateToString(value); |
649 | }, | 651 | }, |
@@ -665,7 +667,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -665,7 +667,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
665 | { | 667 | { |
666 | header: 'Duration (hour)', width: 120, dataIndex: 'durationHour', | 668 | header: 'Duration (hour)', width: 120, dataIndex: 'durationHour', |
667 | id: amdaUI.TimeTableUI.COL_TO_HIDE + '2', | 669 | id: amdaUI.TimeTableUI.COL_TO_HIDE + '2', |
668 | - hidden: true, | 670 | + hidden: Ext.state.Manager.getProvider().get('tt_duration') != 2 ? true : false, |
669 | renderer: function (value) { | 671 | renderer: function (value) { |
670 | return this.dateToString(value); | 672 | return this.dateToString(value); |
671 | }, | 673 | }, |
@@ -686,6 +688,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -686,6 +688,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
686 | }, | 688 | }, |
687 | { | 689 | { |
688 | header: 'Duration (min)', width: 120, dataIndex: 'durationMin', | 690 | header: 'Duration (min)', width: 120, dataIndex: 'durationMin', |
691 | + hidden:Ext.state.Manager.getProvider().get('tt_duration') != 3 ? true : false, | ||
689 | id: amdaUI.TimeTableUI.COL_TO_HIDE + '3', | 692 | id: amdaUI.TimeTableUI.COL_TO_HIDE + '3', |
690 | renderer: function (value) { | 693 | renderer: function (value) { |
691 | return this.dateToString(value); | 694 | return this.dateToString(value); |
@@ -708,7 +711,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -708,7 +711,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
708 | { | 711 | { |
709 | header: 'Duration (sec)', width: 120, dataIndex: 'durationSec', | 712 | header: 'Duration (sec)', width: 120, dataIndex: 'durationSec', |
710 | id: amdaUI.TimeTableUI.COL_TO_HIDE + '4', | 713 | id: amdaUI.TimeTableUI.COL_TO_HIDE + '4', |
711 | - hidden: true, | 714 | + hidden:Ext.state.Manager.getProvider().get('tt_duration') != 4 ? true : false, |
712 | renderer: function (value) { | 715 | renderer: function (value) { |
713 | return Ext.util.Format.number(value, '0.000'); | 716 | return Ext.util.Format.number(value, '0.000'); |
714 | }, | 717 | }, |
@@ -800,8 +803,15 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -800,8 +803,15 @@ Ext.define('amdaUI.TimeTableUI', { | ||
800 | // send refresh event to statistical plugin | 803 | // send refresh event to statistical plugin |
801 | this.fireEvent("refresh"); | 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 |