Commit 07954c7387d472d070cca7514a2c84d3f557d807
1 parent
b58c4275
Exists in
master
and in
112 other branches
move store listeners
Showing
1 changed file
with
12 additions
and
29 deletions
Show diff stats
js/app/controllers/EpnTapModule.js
@@ -38,10 +38,19 @@ Ext.define('amdaDesktop.EpnTapModule', { | @@ -38,10 +38,19 @@ Ext.define('amdaDesktop.EpnTapModule', { | ||
38 | }; | 38 | }; |
39 | 39 | ||
40 | this.aquireElements(); | 40 | this.aquireElements(); |
41 | - this.addStoreListeners(); | 41 | + |
42 | + // create productTypeDict based on productTypesStore | ||
43 | + this.productTypesStore.on({ | ||
44 | + load: function(store) { | ||
45 | + this.productTypeDict = {}; | ||
46 | + for (var key in store.data.map) { | ||
47 | + this.productTypeDict[key] = store.data.map[key].data.name; | ||
48 | + } | ||
49 | + }, | ||
50 | + scope: this | ||
51 | + }); | ||
42 | 52 | ||
43 | this.servicesStore.load(); | 53 | this.servicesStore.load(); |
44 | - // this.metadataStore.load(); | ||
45 | this.productTypesStore.load(); | 54 | this.productTypesStore.load(); |
46 | }, | 55 | }, |
47 | 56 | ||
@@ -68,32 +77,6 @@ Ext.define('amdaDesktop.EpnTapModule', { | @@ -68,32 +77,6 @@ Ext.define('amdaDesktop.EpnTapModule', { | ||
68 | this.targetNamesStore = Ext.data.StoreManager.lookup('targetNamesStore'); | 77 | this.targetNamesStore = Ext.data.StoreManager.lookup('targetNamesStore'); |
69 | }, | 78 | }, |
70 | 79 | ||
71 | - addStoreListeners: function() { | ||
72 | - // this.servicesStore.on({ | ||
73 | - // beforeload: function(store) { | ||
74 | - // loadMask.show(); | ||
75 | - // AmdaAction.epnTapGetServices( function(services) { | ||
76 | - // store.add(services); | ||
77 | - // }); | ||
78 | - // }, | ||
79 | - // add: function(store) { | ||
80 | - // this.updateNbResults(); | ||
81 | - // loadMask.hide(); | ||
82 | - // }, | ||
83 | - // scope: this | ||
84 | - // }); | ||
85 | - | ||
86 | - this.productTypesStore.on({ | ||
87 | - load: function(store) { | ||
88 | - this.productTypeDict = {}; | ||
89 | - for (var key in store.data.map) { | ||
90 | - this.productTypeDict[key] = store.data.map[key].data.name; | ||
91 | - } | ||
92 | - }, | ||
93 | - scope: this | ||
94 | - }); | ||
95 | - }, | ||
96 | - | ||
97 | addUIListeners: function() { | 80 | addUIListeners: function() { |
98 | this.servicesGrid.on('cellclick', function(grid, td, cellIndex, record) { | 81 | this.servicesGrid.on('cellclick', function(grid, td, cellIndex, record) { |
99 | this.onServiceSelected(record.data['id']); | 82 | this.onServiceSelected(record.data['id']); |
@@ -366,7 +349,7 @@ Ext.define('amdaDesktop.EpnTapModule', { | @@ -366,7 +349,7 @@ Ext.define('amdaDesktop.EpnTapModule', { | ||
366 | // this.metadataStore.clearFilter(); | 349 | // this.metadataStore.clearFilter(); |
367 | // }, this); | 350 | // }, this); |
368 | // this.servicesStore.sort('nb_results', 'DESC'); | 351 | // this.servicesStore.sort('nb_results', 'DESC'); |
369 | - // | 352 | + // |
370 | // var timeMin = this.metadataStore.min('time_min'); | 353 | // var timeMin = this.metadataStore.min('time_min'); |
371 | // var timeMax = this.metadataStore.max('time_max'); | 354 | // var timeMax = this.metadataStore.max('time_max'); |
372 | this.timeSelector.setLimits(timeMin, timeMax); | 355 | this.timeSelector.setLimits(timeMin, timeMax); |