Commit b2e93d9299f3253a9cd7212e1fac9ec9c1aa37ce
Exists in
master
and in
110 other branches
Merge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM
Showing
1 changed file
with
182 additions
and
185 deletions
Show diff stats
js/app/views/FiltersUI.js
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | ******************************************************************************** | 9 | ******************************************************************************** |
10 | * FT Id : Date : Name - Description | 10 | * FT Id : Date : Name - Description |
11 | ******************************************************************************* | 11 | ******************************************************************************* |
12 | - * : | 12 | + * : |
13 | */ | 13 | */ |
14 | 14 | ||
15 | /* | 15 | /* |
@@ -19,41 +19,41 @@ | @@ -19,41 +19,41 @@ | ||
19 | Ext.define('amdaUI.FilterGridPanel', { | 19 | Ext.define('amdaUI.FilterGridPanel', { |
20 | extend : 'Ext.grid.Panel', | 20 | extend : 'Ext.grid.Panel', |
21 | alias : 'widget.gridFilter', | 21 | alias : 'widget.gridFilter', |
22 | - | 22 | + |
23 | filtersInfoStore : null, | 23 | filtersInfoStore : null, |
24 | filtersListStore : null, | 24 | filtersListStore : null, |
25 | - | 25 | + |
26 | selectListStore : null, | 26 | selectListStore : null, |
27 | crtFilter : null, | 27 | crtFilter : null, |
28 | - | 28 | + |
29 | opStore : null, | 29 | opStore : null, |
30 | condStore : null, | 30 | condStore : null, |
31 | - | 31 | + |
32 | groupingFeature : null, | 32 | groupingFeature : null, |
33 | valueColumn : null, | 33 | valueColumn : null, |
34 | - | 34 | + |
35 | groupMenu : null, | 35 | groupMenu : null, |
36 | itemMenu : null, | 36 | itemMenu : null, |
37 | - | ||
38 | - constructor: function(config) | ||
39 | - { | 37 | + |
38 | + constructor: function(config) | ||
39 | + { | ||
40 | this.init(config); | 40 | this.init(config); |
41 | this.callParent(arguments); | 41 | this.callParent(arguments); |
42 | }, | 42 | }, |
43 | - | 43 | + |
44 | setFiltersInfoStore: function(infoStore) | 44 | setFiltersInfoStore: function(infoStore) |
45 | { | 45 | { |
46 | this.filtersInfoStore = infoStore; | 46 | this.filtersInfoStore = infoStore; |
47 | }, | 47 | }, |
48 | - | 48 | + |
49 | setFiltersListStore: function(listStore) | 49 | setFiltersListStore: function(listStore) |
50 | { | 50 | { |
51 | this.filtersListStore = listStore; | 51 | this.filtersListStore = listStore; |
52 | }, | 52 | }, |
53 | - | 53 | + |
54 | setConditions : function(record) | 54 | setConditions : function(record) |
55 | { | 55 | { |
56 | - this.editingPlugin.completeEdit(); | 56 | + this.editingPlugin.completeEdit(); |
57 | this.crtFilter = record; | 57 | this.crtFilter = record; |
58 | this.reconfigure(record.conditions()); | 58 | this.reconfigure(record.conditions()); |
59 | this.store.groupField = 'type'; | 59 | this.store.groupField = 'type'; |
@@ -61,59 +61,59 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -61,59 +61,59 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
61 | if (record.conditions().getCount() > 0) | 61 | if (record.conditions().getCount() > 0) |
62 | this.getSelectionModel().select(record.conditions().getAt(0)); | 62 | this.getSelectionModel().select(record.conditions().getAt(0)); |
63 | }, | 63 | }, |
64 | - | 64 | + |
65 | setConditionType : function(condType,condInfo,reset) | 65 | setConditionType : function(condType,condInfo,reset) |
66 | { | 66 | { |
67 | if (!condInfo) | 67 | if (!condInfo) |
68 | return; | 68 | return; |
69 | - | 69 | + |
70 | //update current conditions types store | 70 | //update current conditions types store |
71 | this.condStore.removeAll(); | 71 | this.condStore.removeAll(); |
72 | - | 72 | + |
73 | this.filtersInfoStore.getById(condType).conditions().data.each(function(cond) | 73 | this.filtersInfoStore.getById(condType).conditions().data.each(function(cond) |
74 | { | 74 | { |
75 | this.condStore.add(cond); | 75 | this.condStore.add(cond); |
76 | }, | 76 | }, |
77 | this | 77 | this |
78 | ); | 78 | ); |
79 | - | 79 | + |
80 | //update current operators store | 80 | //update current operators store |
81 | this.opStore.removeAll(); | 81 | this.opStore.removeAll(); |
82 | - | 82 | + |
83 | condInfo.ops().data.each(function(op) | 83 | condInfo.ops().data.each(function(op) |
84 | { | 84 | { |
85 | this.opStore.add({id : op.get('id'), name : op.get('name')}); | 85 | this.opStore.add({id : op.get('id'), name : op.get('name')}); |
86 | }, | 86 | }, |
87 | this | 87 | this |
88 | ); | 88 | ); |
89 | - | 89 | + |
90 | //update current value field | 90 | //update current value field |
91 | var valueField = this.getValueField(condInfo); | 91 | var valueField = this.getValueField(condInfo); |
92 | - this.editingPlugin.completeEdit(); | 92 | + this.editingPlugin.completeEdit(); |
93 | this.editingPlugin.setColumnField(this.columns[3],valueField); | 93 | this.editingPlugin.setColumnField(this.columns[3],valueField); |
94 | - | 94 | + |
95 | //get current cell | 95 | //get current cell |
96 | var crtCell; | 96 | var crtCell; |
97 | - if (this.getSelectionModel().hasSelection()) { | ||
98 | - crtCell = this.getSelectionModel().getSelection()[0]; | 97 | + if (this.getSelectionModel().hasSelection()) { |
98 | + crtCell = this.getSelectionModel().getSelection()[0]; | ||
99 | } | 99 | } |
100 | else | 100 | else |
101 | - return; | 101 | + return; |
102 | crtCell.set('condId',condInfo.get('id')); | 102 | crtCell.set('condId',condInfo.get('id')); |
103 | - | 103 | + |
104 | if (reset) | 104 | if (reset) |
105 | - { | 105 | + { |
106 | //set first operator | 106 | //set first operator |
107 | crtCell.set('opId',this.opStore.getAt(0).get('id')); | 107 | crtCell.set('opId',this.opStore.getAt(0).get('id')); |
108 | - | 108 | + |
109 | //reset value field | 109 | //reset value field |
110 | switch (valueField.xtype) | 110 | switch (valueField.xtype) |
111 | { | 111 | { |
112 | - case 'combobox' : | 112 | + case 'combobox' : |
113 | crtCell.set('value',valueField.store.getAt(0).get('name')); | 113 | crtCell.set('value',valueField.store.getAt(0).get('name')); |
114 | break; | 114 | break; |
115 | case 'datefield' : | 115 | case 'datefield' : |
116 | - var date = new Date(); | 116 | + var date = new Date(); |
117 | crtCell.set('value',date); | 117 | crtCell.set('value',date); |
118 | break; | 118 | break; |
119 | default : | 119 | default : |
@@ -121,7 +121,7 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -121,7 +121,7 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
121 | } | 121 | } |
122 | } | 122 | } |
123 | }, | 123 | }, |
124 | - | 124 | + |
125 | getValueField : function(condInfo) | 125 | getValueField : function(condInfo) |
126 | { | 126 | { |
127 | //get field type in relation with the condition | 127 | //get field type in relation with the condition |
@@ -130,21 +130,21 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -130,21 +130,21 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
130 | case 'select' : | 130 | case 'select' : |
131 | if (!this.filtersListStore.getById(condInfo.get('selectList'))) | 131 | if (!this.filtersListStore.getById(condInfo.get('selectList'))) |
132 | console.log('Error - Missing select list definition for '+condInfo.get('selectList')); | 132 | console.log('Error - Missing select list definition for '+condInfo.get('selectList')); |
133 | - else { | 133 | + else { |
134 | // to avoid an attempt to load remotely association store in combobox - it is already here! | 134 | // to avoid an attempt to load remotely association store in combobox - it is already here! |
135 | var store2 = new Ext.data.Store({model : 'amdaModel.FilterSelectListElt'}); | 135 | var store2 = new Ext.data.Store({model : 'amdaModel.FilterSelectListElt'}); |
136 | - | 136 | + |
137 | this.filtersListStore.getById(condInfo.get('selectList')).elems().each(function(record){ | 137 | this.filtersListStore.getById(condInfo.get('selectList')).elems().each(function(record){ |
138 | store2.add(record.copy()); | 138 | store2.add(record.copy()); |
139 | - }); | ||
140 | - | 139 | + }); |
140 | + | ||
141 | return { | 141 | return { |
142 | xtype : 'combobox', | 142 | xtype : 'combobox', |
143 | queryMode: 'local', | 143 | queryMode: 'local', |
144 | editable: false, | 144 | editable: false, |
145 | displayField:'name', | 145 | displayField:'name', |
146 | valueField : 'id', | 146 | valueField : 'id', |
147 | - store : store2 | 147 | + store : store2 |
148 | }; | 148 | }; |
149 | } | 149 | } |
150 | case 'date' : | 150 | case 'date' : |
@@ -159,23 +159,23 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -159,23 +159,23 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
159 | }; | 159 | }; |
160 | 160 | ||
161 | } | 161 | } |
162 | - | 162 | + |
163 | // console.log('Error - Missing value field definition for '+condInfo.get('type')); | 163 | // console.log('Error - Missing value field definition for '+condInfo.get('type')); |
164 | return { | 164 | return { |
165 | xtype : 'textfield' | 165 | xtype : 'textfield' |
166 | }; | 166 | }; |
167 | }, | 167 | }, |
168 | - | 168 | + |
169 | createCondition : function(group) | 169 | createCondition : function(group) |
170 | { | 170 | { |
171 | var rec = Ext.create('amdaModel.FilterDefCond',{ | 171 | var rec = Ext.create('amdaModel.FilterDefCond',{ |
172 | type : group, | 172 | type : group, |
173 | logical : 'and' | 173 | logical : 'and' |
174 | }); | 174 | }); |
175 | - | 175 | + |
176 | return rec; | 176 | return rec; |
177 | }, | 177 | }, |
178 | - | 178 | + |
179 | onAddCondition : function(t) | 179 | onAddCondition : function(t) |
180 | { | 180 | { |
181 | var crtGroup = t.parentMenu.crtGroup; | 181 | var crtGroup = t.parentMenu.crtGroup; |
@@ -187,7 +187,7 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -187,7 +187,7 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
187 | this.store.each(function(cond) | 187 | this.store.each(function(cond) |
188 | { | 188 | { |
189 | if (cond.get('type') == crtGroup) | 189 | if (cond.get('type') == crtGroup) |
190 | - maxIndex = (maxIndex < cond.get('index')) ? cond.get('index') : maxIndex; | 190 | + maxIndex = (maxIndex < cond.get('index')) ? cond.get('index') : maxIndex; |
191 | },this); | 191 | },this); |
192 | rec.set('index',maxIndex+1); | 192 | rec.set('index',maxIndex+1); |
193 | this.store.add(rec); | 193 | this.store.add(rec); |
@@ -196,7 +196,7 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -196,7 +196,7 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
196 | this.getSelectionModel().select(rec); | 196 | this.getSelectionModel().select(rec); |
197 | this.setConditionType(crtGroup,firstCond, true); | 197 | this.setConditionType(crtGroup,firstCond, true); |
198 | }, | 198 | }, |
199 | - | 199 | + |
200 | onInsertCondition : function(t) | 200 | onInsertCondition : function(t) |
201 | { | 201 | { |
202 | if (this.getSelectionModel().hasSelection()) | 202 | if (this.getSelectionModel().hasSelection()) |
@@ -218,7 +218,7 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -218,7 +218,7 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
218 | this.setConditionType(crtRec.get('type'),firstCond, true); | 218 | this.setConditionType(crtRec.get('type'),firstCond, true); |
219 | } | 219 | } |
220 | }, | 220 | }, |
221 | - | 221 | + |
222 | onDeleteCondition : function(t) | 222 | onDeleteCondition : function(t) |
223 | { | 223 | { |
224 | if (this.getSelectionModel().hasSelection()) | 224 | if (this.getSelectionModel().hasSelection()) |
@@ -229,7 +229,7 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -229,7 +229,7 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
229 | this.store.group('type'); | 229 | this.store.group('type'); |
230 | }; | 230 | }; |
231 | }, | 231 | }, |
232 | - | 232 | + |
233 | onClearGroupConditions : function(t) | 233 | onClearGroupConditions : function(t) |
234 | { | 234 | { |
235 | var crtGroup = t.parentMenu.crtGroup; | 235 | var crtGroup = t.parentMenu.crtGroup; |
@@ -243,17 +243,17 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -243,17 +243,17 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
243 | if (rec.get('index') == -1) | 243 | if (rec.get('index') == -1) |
244 | return; | 244 | return; |
245 | this.store.remove(rec); | 245 | this.store.remove(rec); |
246 | - },this); | 246 | + },this); |
247 | this.store.group('type'); | 247 | this.store.group('type'); |
248 | }, | 248 | }, |
249 | - | 249 | + |
250 | onClearAllConditions : function(t) | 250 | onClearAllConditions : function(t) |
251 | - { | 251 | + { |
252 | var recs = this.store.getGroups(); | 252 | var recs = this.store.getGroups(); |
253 | if (!recs) | 253 | if (!recs) |
254 | return; | 254 | return; |
255 | Ext.each(recs, function (group) | 255 | Ext.each(recs, function (group) |
256 | - { | 256 | + { |
257 | Ext.each(group.children, function (rec) | 257 | Ext.each(group.children, function (rec) |
258 | { | 258 | { |
259 | if (rec.get('index') == -1) | 259 | if (rec.get('index') == -1) |
@@ -264,47 +264,47 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -264,47 +264,47 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
264 | this); | 264 | this); |
265 | this.store.group('type'); | 265 | this.store.group('type'); |
266 | }, | 266 | }, |
267 | - | 267 | + |
268 | onSelectConditionType : function(combo,records,eOpts) | 268 | onSelectConditionType : function(combo,records,eOpts) |
269 | { | 269 | { |
270 | if (!records || (records.length != 1)) | 270 | if (!records || (records.length != 1)) |
271 | return; | 271 | return; |
272 | this.setConditionType(records[0].getFilter().get('id'),records[0],true); | 272 | this.setConditionType(records[0].getFilter().get('id'),records[0],true); |
273 | }, | 273 | }, |
274 | - | 274 | + |
275 | createCellEditingPlugin : function() | 275 | createCellEditingPlugin : function() |
276 | { | 276 | { |
277 | var cellPlug = Ext.create('Ext.grid.plugin.CellEditing', { | 277 | var cellPlug = Ext.create('Ext.grid.plugin.CellEditing', { |
278 | clicksToEdit: 2, | 278 | clicksToEdit: 2, |
279 | listeners: { | 279 | listeners: { |
280 | - beforeedit: function(o, el, opt) { | 280 | + beforeedit: function(o, el, opt) { |
281 | if ((el.field == 'logical') && (el.record.get('index') <= 0)) | 281 | if ((el.field == 'logical') && (el.record.get('index') <= 0)) |
282 | return false; | 282 | return false; |
283 | return true; | 283 | return true; |
284 | } | 284 | } |
285 | } | 285 | } |
286 | - }); | ||
287 | - | 286 | + }); |
287 | + | ||
288 | return cellPlug; | 288 | return cellPlug; |
289 | }, | 289 | }, |
290 | - | 290 | + |
291 | createOperatorStore : function() | 291 | createOperatorStore : function() |
292 | { | 292 | { |
293 | this.opStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterOpInfo'}); | 293 | this.opStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterOpInfo'}); |
294 | return this.opStore; | 294 | return this.opStore; |
295 | }, | 295 | }, |
296 | - | 296 | + |
297 | createFilterCondInfoStore : function() | 297 | createFilterCondInfoStore : function() |
298 | { | 298 | { |
299 | this.condStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterConditionInfo'}); | 299 | this.condStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterConditionInfo'}); |
300 | return this.condStore; | 300 | return this.condStore; |
301 | }, | 301 | }, |
302 | - | 302 | + |
303 | createLogicalColumn : function() | 303 | createLogicalColumn : function() |
304 | { | 304 | { |
305 | return { | 305 | return { |
306 | - header: '', | ||
307 | - dataIndex: 'logical', | 306 | + header: '', |
307 | + dataIndex: 'logical', | ||
308 | flex: 1, | 308 | flex: 1, |
309 | allowBlank : false, | 309 | allowBlank : false, |
310 | renderer: function(value,metaData,record,rowIndex,colIndex,store,view) | 310 | renderer: function(value,metaData,record,rowIndex,colIndex,store,view) |
@@ -322,18 +322,18 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -322,18 +322,18 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
322 | } | 322 | } |
323 | }; | 323 | }; |
324 | }, | 324 | }, |
325 | - | 325 | + |
326 | createTypeColumn : function() | 326 | createTypeColumn : function() |
327 | { | 327 | { |
328 | - return { | ||
329 | - header: 'Type', | ||
330 | - dataIndex: 'condId', | 328 | + return { |
329 | + header: 'Type', | ||
330 | + dataIndex: 'condId', | ||
331 | flex: 3, | 331 | flex: 3, |
332 | allowBlank : false, | 332 | allowBlank : false, |
333 | renderer: function(value,metaData,record,rowIndex,colIndex,store,view) | 333 | renderer: function(value,metaData,record,rowIndex,colIndex,store,view) |
334 | { | 334 | { |
335 | var crtType = record.get('type'); | 335 | var crtType = record.get('type'); |
336 | - var conditions = this.filtersInfoStore.getById(crtType).conditions(); | 336 | + var conditions = this.filtersInfoStore.getById(crtType).conditions(); |
337 | var condition = conditions.getById(record.get('condId')); | 337 | var condition = conditions.getById(record.get('condId')); |
338 | if (condition) | 338 | if (condition) |
339 | return condition.get('name'); | 339 | return condition.get('name'); |
@@ -354,21 +354,21 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -354,21 +354,21 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
354 | 'select': this.onSelectConditionType | 354 | 'select': this.onSelectConditionType |
355 | } | 355 | } |
356 | } | 356 | } |
357 | - }; | 357 | + }; |
358 | }, | 358 | }, |
359 | - | 359 | + |
360 | createOperatorColumn : function() | 360 | createOperatorColumn : function() |
361 | { | 361 | { |
362 | - return { | ||
363 | - header: '', | ||
364 | - dataIndex: 'opId', | 362 | + return { |
363 | + header: '', | ||
364 | + dataIndex: 'opId', | ||
365 | flex: 1, | 365 | flex: 1, |
366 | allowBlank : false, | 366 | allowBlank : false, |
367 | renderer: function(value,metaData,record,rowIndex,colIndex,store,view) | 367 | renderer: function(value,metaData,record,rowIndex,colIndex,store,view) |
368 | { | 368 | { |
369 | var crtType = record.get('type'); | 369 | var crtType = record.get('type'); |
370 | var conditions = this.filtersInfoStore.getById(crtType).conditions(); | 370 | var conditions = this.filtersInfoStore.getById(crtType).conditions(); |
371 | - | 371 | + |
372 | var condition = conditions.getById(record.get('condId')); | 372 | var condition = conditions.getById(record.get('condId')); |
373 | if (!condition || !condition.ops().getById(record.get('opId'))) | 373 | if (!condition || !condition.ops().getById(record.get('opId'))) |
374 | return ''; | 374 | return ''; |
@@ -383,21 +383,21 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -383,21 +383,21 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
383 | valueField : 'id', | 383 | valueField : 'id', |
384 | store : this.createOperatorStore() | 384 | store : this.createOperatorStore() |
385 | } | 385 | } |
386 | - | 386 | + |
387 | }; | 387 | }; |
388 | }, | 388 | }, |
389 | - | 389 | + |
390 | createValueColumn : function() | 390 | createValueColumn : function() |
391 | { | 391 | { |
392 | - return { | ||
393 | - header: 'Value', | ||
394 | - dataIndex: 'value', | 392 | + return { |
393 | + header: 'Value', | ||
394 | + dataIndex: 'value', | ||
395 | flex: 3, | 395 | flex: 3, |
396 | renderer: function(value,metaData,record,rowIndex,colIndex,store,view) | 396 | renderer: function(value,metaData,record,rowIndex,colIndex,store,view) |
397 | { | 397 | { |
398 | var crtType = record.get('type'); | 398 | var crtType = record.get('type'); |
399 | var conditions = this.filtersInfoStore.getById(crtType).conditions(); | 399 | var conditions = this.filtersInfoStore.getById(crtType).conditions(); |
400 | - var condition = conditions.getById(record.get('condId')); | 400 | + var condition = conditions.getById(record.get('condId')); |
401 | if (!condition) | 401 | if (!condition) |
402 | return value; | 402 | return value; |
403 | switch(condition.get('type')) | 403 | switch(condition.get('type')) |
@@ -417,7 +417,7 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -417,7 +417,7 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
417 | } | 417 | } |
418 | }; | 418 | }; |
419 | }, | 419 | }, |
420 | - | 420 | + |
421 | createColumns : function() | 421 | createColumns : function() |
422 | { | 422 | { |
423 | return [ | 423 | return [ |
@@ -427,11 +427,11 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -427,11 +427,11 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
427 | this.createValueColumn() | 427 | this.createValueColumn() |
428 | ]; | 428 | ]; |
429 | }, | 429 | }, |
430 | - | 430 | + |
431 | createContextMenus : function() | 431 | createContextMenus : function() |
432 | { | 432 | { |
433 | var me = this; | 433 | var me = this; |
434 | - | 434 | + |
435 | this.groupMenu = Ext.create('Ext.menu.Menu', { | 435 | this.groupMenu = Ext.create('Ext.menu.Menu', { |
436 | crtGroup : null, | 436 | crtGroup : null, |
437 | items: [{ | 437 | items: [{ |
@@ -454,7 +454,7 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -454,7 +454,7 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
454 | } | 454 | } |
455 | ] | 455 | ] |
456 | }); | 456 | }); |
457 | - | 457 | + |
458 | this.itemMenu = Ext.create('Ext.menu.Menu', { | 458 | this.itemMenu = Ext.create('Ext.menu.Menu', { |
459 | items: [{ | 459 | items: [{ |
460 | text: 'Insert', | 460 | text: 'Insert', |
@@ -468,21 +468,21 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -468,21 +468,21 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
468 | scope : me | 468 | scope : me |
469 | } | 469 | } |
470 | ] | 470 | ] |
471 | - }); | 471 | + }); |
472 | }, | 472 | }, |
473 | - | 473 | + |
474 | createGroupingFeature : function() | 474 | createGroupingFeature : function() |
475 | { | 475 | { |
476 | var me = this; | 476 | var me = this; |
477 | - | 477 | + |
478 | this.groupingFeature = Ext.create('Ext.grid.feature.Grouping',{ | 478 | this.groupingFeature = Ext.create('Ext.grid.feature.Grouping',{ |
479 | enableGroupingMenu: true, | 479 | enableGroupingMenu: true, |
480 | enableNoGroups : false, | 480 | enableNoGroups : false, |
481 | showGroupsText : false, | 481 | showGroupsText : false, |
482 | - groupHeaderTpl: Ext.create('Ext.XTemplate', | ||
483 | - '{name:this.filter_type} ({rows.length:this.cond_info})', | 482 | + groupHeaderTpl: Ext.create('Ext.XTemplate', |
483 | + '{name:this.filter_type} ({rows.length:this.cond_info})', | ||
484 | { | 484 | { |
485 | - cond_info : function(val) | 485 | + cond_info : function(val) |
486 | { | 486 | { |
487 | var nbCond = val < 1 ? 0 : val-1; | 487 | var nbCond = val < 1 ? 0 : val-1; |
488 | return (nbCond > 1) ? nbCond+' conditions' : nbCond+' condition'; | 488 | return (nbCond > 1) ? nbCond+' conditions' : nbCond+' condition'; |
@@ -497,20 +497,20 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -497,20 +497,20 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
497 | return rec.get('name'); | 497 | return rec.get('name'); |
498 | } | 498 | } |
499 | } | 499 | } |
500 | - | 500 | + |
501 | ) | 501 | ) |
502 | }); | 502 | }); |
503 | }, | 503 | }, |
504 | - | ||
505 | - init : function(config) | 504 | + |
505 | + init : function(config) | ||
506 | { | 506 | { |
507 | var me = this; | 507 | var me = this; |
508 | - | 508 | + |
509 | this.createContextMenus(); | 509 | this.createContextMenus(); |
510 | - | 510 | + |
511 | this.createGroupingFeature(); | 511 | this.createGroupingFeature(); |
512 | - | ||
513 | - var myConf = | 512 | + |
513 | + var myConf = | ||
514 | { | 514 | { |
515 | plugins : [ | 515 | plugins : [ |
516 | this.createCellEditingPlugin() | 516 | this.createCellEditingPlugin() |
@@ -531,12 +531,12 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -531,12 +531,12 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
531 | { | 531 | { |
532 | if (selections && selections[0]) | 532 | if (selections && selections[0]) |
533 | { | 533 | { |
534 | - | 534 | + |
535 | var condId = selections[0].get('condId'); | 535 | var condId = selections[0].get('condId'); |
536 | - | 536 | + |
537 | var crtType = selections[0].get('type'); | 537 | var crtType = selections[0].get('type'); |
538 | var conditions = this.filtersInfoStore.getById(crtType).conditions(); | 538 | var conditions = this.filtersInfoStore.getById(crtType).conditions(); |
539 | - | 539 | + |
540 | var cond = conditions.getById(condId); | 540 | var cond = conditions.getById(condId); |
541 | if (cond) | 541 | if (cond) |
542 | { | 542 | { |
@@ -550,13 +550,13 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -550,13 +550,13 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
550 | this.itemMenu.showAt(e.getXY()); | 550 | this.itemMenu.showAt(e.getXY()); |
551 | }, | 551 | }, |
552 | groupcontextmenu : function(view, node, group, e) | 552 | groupcontextmenu : function(view, node, group, e) |
553 | - { | 553 | + { |
554 | e.stopEvent(); | 554 | e.stopEvent(); |
555 | this.groupMenu.crtGroup = group; | 555 | this.groupMenu.crtGroup = group; |
556 | this.groupMenu.showAt(e.getXY()); | 556 | this.groupMenu.showAt(e.getXY()); |
557 | }, | 557 | }, |
558 | scope : this | 558 | scope : this |
559 | - | 559 | + |
560 | } | 560 | } |
561 | }; | 561 | }; |
562 | Ext.apply (this , Ext.apply (arguments, myConf)); | 562 | Ext.apply (this , Ext.apply (arguments, myConf)); |
@@ -564,7 +564,7 @@ Ext.define('amdaUI.FilterGridPanel', { | @@ -564,7 +564,7 @@ Ext.define('amdaUI.FilterGridPanel', { | ||
564 | }); | 564 | }); |
565 | 565 | ||
566 | /* | 566 | /* |
567 | - * Filters main interface | 567 | + * Filters main interface |
568 | */ | 568 | */ |
569 | 569 | ||
570 | Ext.define('amdaUI.FiltersUI', { | 570 | Ext.define('amdaUI.FiltersUI', { |
@@ -575,27 +575,27 @@ Ext.define('amdaUI.FiltersUI', { | @@ -575,27 +575,27 @@ Ext.define('amdaUI.FiltersUI', { | ||
575 | 'amdaModel.FilterInfo', | 575 | 'amdaModel.FilterInfo', |
576 | 'amdaModel.FilterDef' | 576 | 'amdaModel.FilterDef' |
577 | ], | 577 | ], |
578 | - | 578 | + |
579 | newFilterName : 'New_Filter_', | 579 | newFilterName : 'New_Filter_', |
580 | - | 580 | + |
581 | //filters info to build interface | 581 | //filters info to build interface |
582 | filtersInfoStore : null, | 582 | filtersInfoStore : null, |
583 | filtersListStore : null, | 583 | filtersListStore : null, |
584 | - | ||
585 | - constructor: function(config) { | 584 | + |
585 | + constructor: function(config) { | ||
586 | this.init(config); | 586 | this.init(config); |
587 | this.callParent(arguments); | 587 | this.callParent(arguments); |
588 | }, | 588 | }, |
589 | - | 589 | + |
590 | onSelect : function(combo,records,eOpts) | 590 | onSelect : function(combo,records,eOpts) |
591 | { | 591 | { |
592 | if (!records || (records.length != 1)) | 592 | if (!records || (records.length != 1)) |
593 | - return; | 593 | + return; |
594 | var record = records[0]; | 594 | var record = records[0]; |
595 | this.setFilterName(record.get('name')); | 595 | this.setFilterName(record.get('name')); |
596 | this.grid.setConditions(record); | 596 | this.grid.setConditions(record); |
597 | }, | 597 | }, |
598 | - | 598 | + |
599 | onBeforeSelect: function(combo, record, index) | 599 | onBeforeSelect: function(combo, record, index) |
600 | { | 600 | { |
601 | /*var me = this; | 601 | /*var me = this; |
@@ -617,12 +617,12 @@ Ext.define('amdaUI.FiltersUI', { | @@ -617,12 +617,12 @@ Ext.define('amdaUI.FiltersUI', { | ||
617 | }*/ | 617 | }*/ |
618 | return true; | 618 | return true; |
619 | }, | 619 | }, |
620 | - | 620 | + |
621 | onAddFilter : function(t) | 621 | onAddFilter : function(t) |
622 | { | 622 | { |
623 | this.addFilter(null,null); | 623 | this.addFilter(null,null); |
624 | }, | 624 | }, |
625 | - | 625 | + |
626 | addFilter : function(name,conds,successfn) | 626 | addFilter : function(name,conds,successfn) |
627 | { | 627 | { |
628 | var combo = this.getFilterCombo(); | 628 | var combo = this.getFilterCombo(); |
@@ -630,20 +630,20 @@ Ext.define('amdaUI.FiltersUI', { | @@ -630,20 +630,20 @@ Ext.define('amdaUI.FiltersUI', { | ||
630 | return null; | 630 | return null; |
631 | 631 | ||
632 | var newRec = Ext.create('amdaModel.FilterDef'); | 632 | var newRec = Ext.create('amdaModel.FilterDef'); |
633 | - | 633 | + |
634 | if (name != null) | 634 | if (name != null) |
635 | newRec.set('name',name); | 635 | newRec.set('name',name); |
636 | - | 636 | + |
637 | newRec.conditions(); | 637 | newRec.conditions(); |
638 | - | 638 | + |
639 | if (conds != null) | 639 | if (conds != null) |
640 | Ext.each(conds, function(cond) | 640 | Ext.each(conds, function(cond) |
641 | { | 641 | { |
642 | newRec.conditions().add(cond); | 642 | newRec.conditions().add(cond); |
643 | },this); | 643 | },this); |
644 | - | 644 | + |
645 | combo.store.add(newRec); | 645 | combo.store.add(newRec); |
646 | - | 646 | + |
647 | //sync store with the server | 647 | //sync store with the server |
648 | combo.store.sync({ | 648 | combo.store.sync({ |
649 | scope: this, | 649 | scope: this, |
@@ -655,27 +655,27 @@ Ext.define('amdaUI.FiltersUI', { | @@ -655,27 +655,27 @@ Ext.define('amdaUI.FiltersUI', { | ||
655 | newRec.conditions().removeAll(); | 655 | newRec.conditions().removeAll(); |
656 | newRec.conditions().add(resRec.conditions); | 656 | newRec.conditions().add(resRec.conditions); |
657 | combo.select(newRec); | 657 | combo.select(newRec); |
658 | - combo.fireEvent('select', combo, [newRec] ); | 658 | + combo.fireEvent('select', combo, [newRec] ); |
659 | if (successfn) | 659 | if (successfn) |
660 | successfn.call(this,newRec); | 660 | successfn.call(this,newRec); |
661 | }}); | 661 | }}); |
662 | - | 662 | + |
663 | return newRec; | 663 | return newRec; |
664 | }, | 664 | }, |
665 | - | 665 | + |
666 | onDeleteFilter : function(t) | 666 | onDeleteFilter : function(t) |
667 | { | 667 | { |
668 | var combo = this.getFilterCombo(); | 668 | var combo = this.getFilterCombo(); |
669 | if (!combo) | 669 | if (!combo) |
670 | return; | 670 | return; |
671 | - | 671 | + |
672 | var rec = this.getCrtFilterRecord(); | 672 | var rec = this.getCrtFilterRecord(); |
673 | - | 673 | + |
674 | if (!rec) | 674 | if (!rec) |
675 | return; | 675 | return; |
676 | if (rec.get("id") == "0") | 676 | if (rec.get("id") == "0") |
677 | Ext.Msg.show( { | 677 | Ext.Msg.show( { |
678 | - title : 'Filter', | 678 | + title : 'Filter', |
679 | msg : 'Cannot delete the Default Filter', | 679 | msg : 'Cannot delete the Default Filter', |
680 | modal : false, | 680 | modal : false, |
681 | icon : Ext.Msg.ERROR, | 681 | icon : Ext.Msg.ERROR, |
@@ -691,47 +691,44 @@ Ext.define('amdaUI.FiltersUI', { | @@ -691,47 +691,44 @@ Ext.define('amdaUI.FiltersUI', { | ||
691 | //fire select event | 691 | //fire select event |
692 | combo.fireEvent('select', combo, [combo.store.getAt(0)]); | 692 | combo.fireEvent('select', combo, [combo.store.getAt(0)]); |
693 | } | 693 | } |
694 | - // the same in WS explorer combobox | 694 | + // the same in WS explorer combobox |
695 | myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id, true, function (module) { | 695 | myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id, true, function (module) { |
696 | var store = module.filtersStore; | 696 | var store = module.filtersStore; |
697 | - var win = module.getUiContent(); | 697 | + var win = module.getUiContent(); |
698 | var comboList = win.dockedItems.getAt(1).items.items[0]; | 698 | var comboList = win.dockedItems.getAt(1).items.items[0]; |
699 | - | ||
700 | - var recList = store.getById(rec.get("id")); | ||
701 | - store.remove(recList); | 699 | + |
700 | + var recList = store.getById(rec.get("id")); | ||
701 | + store.remove(recList); | ||
702 | if (store.getCount() > 0) | 702 | if (store.getCount() > 0) |
703 | - { | ||
704 | - comboList.select(store.getAt(0)); | 703 | + { |
704 | + comboList.select(store.getAt(0)); | ||
705 | //fire select event | 705 | //fire select event |
706 | comboList.fireEvent('select', comboList, [store.getAt(0)]); | 706 | comboList.fireEvent('select', comboList, [store.getAt(0)]); |
707 | - } | 707 | + } |
708 | }); | 708 | }); |
709 | - | 709 | + |
710 | } | 710 | } |
711 | }, | 711 | }, |
712 | - | 712 | + |
713 | onSaveFilter : function(t) | 713 | onSaveFilter : function(t) |
714 | { | 714 | { |
715 | var filters = this.getFilterCombo().getStore().data.items; | 715 | var filters = this.getFilterCombo().getStore().data.items; |
716 | for (key in filters) { | 716 | for (key in filters) { |
717 | if (filters[key].get('name') === this.getFilterName()) { | 717 | if (filters[key].get('name') === this.getFilterName()) { |
718 | - Ext.Msg.show({ | ||
719 | - title:'Duplicated name', | ||
720 | - msg: 'This name is already used.<br/>Please choose an other one or remove the old filter.', | ||
721 | - icon: Ext.Msg.WARNING | ||
722 | - }); | 718 | + myDesktopApp.infoMsg('This name is already used.<br/>' + |
719 | + 'Please choose an other one or remove the old filter.'); | ||
723 | return null; | 720 | return null; |
724 | } | 721 | } |
725 | } | 722 | } |
726 | 723 | ||
727 | var rec = this.getCrtFilterRecord(); | 724 | var rec = this.getCrtFilterRecord(); |
728 | - | 725 | + |
729 | if (!rec) | 726 | if (!rec) |
730 | return; | 727 | return; |
731 | - | 728 | + |
732 | this.saveFilter(rec); | 729 | this.saveFilter(rec); |
733 | }, | 730 | }, |
734 | - | 731 | + |
735 | onApplyFilter : function(t) | 732 | onApplyFilter : function(t) |
736 | { | 733 | { |
737 | var me = this; | 734 | var me = this; |
@@ -748,27 +745,27 @@ Ext.define('amdaUI.FiltersUI', { | @@ -748,27 +745,27 @@ Ext.define('amdaUI.FiltersUI', { | ||
748 | ); | 745 | ); |
749 | return; | 746 | return; |
750 | } | 747 | } |
751 | - | 748 | + |
752 | this.requestApplyFilter(rec); | 749 | this.requestApplyFilter(rec); |
753 | }, | 750 | }, |
754 | - | 751 | + |
755 | requestApplyFilter : function(rec) | 752 | requestApplyFilter : function(rec) |
756 | { | 753 | { |
757 | - AmdaAction.setCrtFilterId({id : rec.get('id')}, | 754 | + AmdaAction.setCrtFilterId({id : rec.get('id')}, |
758 | function (result, e) | 755 | function (result, e) |
759 | { | 756 | { |
760 | var t = e.getTransaction(); | 757 | var t = e.getTransaction(); |
761 | - if (e.status) | ||
762 | - { | 758 | + if (e.status) |
759 | + { | ||
763 | if (result) | 760 | if (result) |
764 | { | 761 | { |
765 | myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id, true, function (module) { | 762 | myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id, true, function (module) { |
766 | - module.setCrtFilter(); | ||
767 | - }); | 763 | + module.setCrtFilter(); |
764 | + }); | ||
768 | } | 765 | } |
769 | else | 766 | else |
770 | Ext.Msg.show( { | 767 | Ext.Msg.show( { |
771 | - title : 'Filter', | 768 | + title : 'Filter', |
772 | msg : 'Cannot apply filter', | 769 | msg : 'Cannot apply filter', |
773 | modal : true, | 770 | modal : true, |
774 | icon : Ext.Msg.ERROR, | 771 | icon : Ext.Msg.ERROR, |
@@ -779,10 +776,10 @@ Ext.define('amdaUI.FiltersUI', { | @@ -779,10 +776,10 @@ Ext.define('amdaUI.FiltersUI', { | ||
779 | { | 776 | { |
780 | // FAILURE | 777 | // FAILURE |
781 | Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); | 778 | Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); |
782 | - } | 779 | + } |
783 | },this); | 780 | },this); |
784 | }, | 781 | }, |
785 | - | 782 | + |
786 | isDirty : function(filter) | 783 | isDirty : function(filter) |
787 | { | 784 | { |
788 | if (filter.dirty) | 785 | if (filter.dirty) |
@@ -798,7 +795,7 @@ Ext.define('amdaUI.FiltersUI', { | @@ -798,7 +795,7 @@ Ext.define('amdaUI.FiltersUI', { | ||
798 | ); | 795 | ); |
799 | return dirty; | 796 | return dirty; |
800 | }, | 797 | }, |
801 | - | 798 | + |
802 | getFilterCombo : function() | 799 | getFilterCombo : function() |
803 | { | 800 | { |
804 | var comboField = this.query('#filter_combo'); | 801 | var comboField = this.query('#filter_combo'); |
@@ -806,7 +803,7 @@ Ext.define('amdaUI.FiltersUI', { | @@ -806,7 +803,7 @@ Ext.define('amdaUI.FiltersUI', { | ||
806 | return null; | 803 | return null; |
807 | return comboField[0]; | 804 | return comboField[0]; |
808 | }, | 805 | }, |
809 | - | 806 | + |
810 | getNameField : function() | 807 | getNameField : function() |
811 | { | 808 | { |
812 | var nameField = this.query('#filter_name'); | 809 | var nameField = this.query('#filter_name'); |
@@ -814,11 +811,11 @@ Ext.define('amdaUI.FiltersUI', { | @@ -814,11 +811,11 @@ Ext.define('amdaUI.FiltersUI', { | ||
814 | return null; | 811 | return null; |
815 | return nameField[0]; | 812 | return nameField[0]; |
816 | }, | 813 | }, |
817 | - | 814 | + |
818 | saveFilter : function(rec,successfn) | 815 | saveFilter : function(rec,successfn) |
819 | { | 816 | { |
820 | var me = this; | 817 | var me = this; |
821 | - | 818 | + |
822 | var filterName = this.getFilterName(); | 819 | var filterName = this.getFilterName(); |
823 | if (!filterName) | 820 | if (!filterName) |
824 | return; | 821 | return; |
@@ -842,13 +839,13 @@ Ext.define('amdaUI.FiltersUI', { | @@ -842,13 +839,13 @@ Ext.define('amdaUI.FiltersUI', { | ||
842 | }); | 839 | }); |
843 | return; | 840 | return; |
844 | } | 841 | } |
845 | - | 842 | + |
846 | var msg; | 843 | var msg; |
847 | if (rec.get('id') == 0) | 844 | if (rec.get('id') == 0) |
848 | msg = 'The name of the default filter cannot be modified. Do you want to create a new instance of this filter?'; | 845 | msg = 'The name of the default filter cannot be modified. Do you want to create a new instance of this filter?'; |
849 | else | 846 | else |
850 | msg = 'Filter name has been changed. Do you want to create a new instance of this filter?'; | 847 | msg = 'Filter name has been changed. Do you want to create a new instance of this filter?'; |
851 | - | 848 | + |
852 | Ext.Msg.confirm('Filters', msg, | 849 | Ext.Msg.confirm('Filters', msg, |
853 | function(btn) { | 850 | function(btn) { |
854 | if (btn == 'yes') | 851 | if (btn == 'yes') |
@@ -861,33 +858,33 @@ Ext.define('amdaUI.FiltersUI', { | @@ -861,33 +858,33 @@ Ext.define('amdaUI.FiltersUI', { | ||
861 | conds[i] = cond.getJsonValues(); | 858 | conds[i] = cond.getJsonValues(); |
862 | }, | 859 | }, |
863 | this); | 860 | this); |
864 | - | 861 | + |
865 | //reload conditions of the current filter | 862 | //reload conditions of the current filter |
866 | amdaModel.FilterDef.load(rec.get('id'), | 863 | amdaModel.FilterDef.load(rec.get('id'), |
867 | { | 864 | { |
868 | scope : this, | 865 | scope : this, |
869 | - callback : function(r, operation) | 866 | + callback : function(r, operation) |
870 | { | 867 | { |
871 | //reset modifications on current record | 868 | //reset modifications on current record |
872 | rec.conditions().removeAll(); | 869 | rec.conditions().removeAll(); |
873 | rec.conditions().loadData(r.conditions().data.items); | 870 | rec.conditions().loadData(r.conditions().data.items); |
874 | //create the new filter | 871 | //create the new filter |
875 | var newRec = this.addFilter(filterName,conds,successfn); | 872 | var newRec = this.addFilter(filterName,conds,successfn); |
876 | - | 873 | + |
877 | } | 874 | } |
878 | - } | 875 | + } |
879 | ); | 876 | ); |
880 | return; | 877 | return; |
881 | - } | ||
882 | - | 878 | + } |
879 | + | ||
883 | if (rec.get('id') == 0) | 880 | if (rec.get('id') == 0) |
884 | { | 881 | { |
885 | filterName = rec.get('name'); //cannot change default filter name | 882 | filterName = rec.get('name'); //cannot change default filter name |
886 | this.setFilterName(filterName); | 883 | this.setFilterName(filterName); |
887 | } | 884 | } |
888 | - | 885 | + |
889 | //change the name of the filter | 886 | //change the name of the filter |
890 | - rec.set('name',filterName); | 887 | + rec.set('name',filterName); |
891 | //save modifications | 888 | //save modifications |
892 | rec.save({ | 889 | rec.save({ |
893 | success: function() { | 890 | success: function() { |
@@ -905,9 +902,9 @@ Ext.define('amdaUI.FiltersUI', { | @@ -905,9 +902,9 @@ Ext.define('amdaUI.FiltersUI', { | ||
905 | }); | 902 | }); |
906 | }, | 903 | }, |
907 | this | 904 | this |
908 | - ); | 905 | + ); |
909 | }, | 906 | }, |
910 | - | 907 | + |
911 | setFilterName : function(n) | 908 | setFilterName : function(n) |
912 | { | 909 | { |
913 | var nameField = this.getNameField(); | 910 | var nameField = this.getNameField(); |
@@ -915,13 +912,13 @@ Ext.define('amdaUI.FiltersUI', { | @@ -915,13 +912,13 @@ Ext.define('amdaUI.FiltersUI', { | ||
915 | return; | 912 | return; |
916 | nameField.setValue(n); | 913 | nameField.setValue(n); |
917 | }, | 914 | }, |
918 | - | 915 | + |
919 | getFilterName : function() | 916 | getFilterName : function() |
920 | { | 917 | { |
921 | var nameField = this.getNameField(); | 918 | var nameField = this.getNameField(); |
922 | return nameField.getValue(); | 919 | return nameField.getValue(); |
923 | }, | 920 | }, |
924 | - | 921 | + |
925 | getCrtFilterRecord : function() | 922 | getCrtFilterRecord : function() |
926 | { | 923 | { |
927 | var combo = this.getFilterCombo(); | 924 | var combo = this.getFilterCombo(); |
@@ -929,14 +926,14 @@ Ext.define('amdaUI.FiltersUI', { | @@ -929,14 +926,14 @@ Ext.define('amdaUI.FiltersUI', { | ||
929 | return null; | 926 | return null; |
930 | return combo.store.getById(combo.getValue()); | 927 | return combo.store.getById(combo.getValue()); |
931 | }, | 928 | }, |
932 | - | 929 | + |
933 | setCrtFilter : function() | 930 | setCrtFilter : function() |
934 | - { | 931 | + { |
935 | AmdaAction.getCrtFilterId(function (result, e) | 932 | AmdaAction.getCrtFilterId(function (result, e) |
936 | { | 933 | { |
937 | var t = e.getTransaction(); | 934 | var t = e.getTransaction(); |
938 | - if (e.status) | ||
939 | - { | 935 | + if (e.status) |
936 | + { | ||
940 | if (result) | 937 | if (result) |
941 | { | 938 | { |
942 | var crtId = result; | 939 | var crtId = result; |
@@ -960,17 +957,17 @@ Ext.define('amdaUI.FiltersUI', { | @@ -960,17 +957,17 @@ Ext.define('amdaUI.FiltersUI', { | ||
960 | { | 957 | { |
961 | // FAILURE | 958 | // FAILURE |
962 | Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); | 959 | Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); |
963 | - } | 960 | + } |
964 | },this); | 961 | },this); |
965 | }, | 962 | }, |
966 | - | 963 | + |
967 | createFilterStore : function() | 964 | createFilterStore : function() |
968 | { | 965 | { |
969 | return Ext.create('Ext.data.Store', | 966 | return Ext.create('Ext.data.Store', |
970 | { | 967 | { |
971 | model: 'amdaModel.FilterDef', | 968 | model: 'amdaModel.FilterDef', |
972 | autoLoad : true, | 969 | autoLoad : true, |
973 | - listeners : | 970 | + listeners : |
974 | { | 971 | { |
975 | 'load' : function(store, records, successful) | 972 | 'load' : function(store, records, successful) |
976 | { | 973 | { |
@@ -987,10 +984,10 @@ Ext.define('amdaUI.FiltersUI', { | @@ -987,10 +984,10 @@ Ext.define('amdaUI.FiltersUI', { | ||
987 | }, | 984 | }, |
988 | scope : this | 985 | scope : this |
989 | } | 986 | } |
990 | - | 987 | + |
991 | }); | 988 | }); |
992 | }, | 989 | }, |
993 | - | 990 | + |
994 | reloadFilter : function() | 991 | reloadFilter : function() |
995 | { | 992 | { |
996 | var combo = this.getFilterCombo(); | 993 | var combo = this.getFilterCombo(); |
@@ -998,7 +995,7 @@ Ext.define('amdaUI.FiltersUI', { | @@ -998,7 +995,7 @@ Ext.define('amdaUI.FiltersUI', { | ||
998 | return; | 995 | return; |
999 | combo.getStore().reload(); | 996 | combo.getStore().reload(); |
1000 | }, | 997 | }, |
1001 | - | 998 | + |
1002 | createToolBar : function() | 999 | createToolBar : function() |
1003 | { | 1000 | { |
1004 | var me = this; | 1001 | var me = this; |
@@ -1041,10 +1038,10 @@ Ext.define('amdaUI.FiltersUI', { | @@ -1041,10 +1038,10 @@ Ext.define('amdaUI.FiltersUI', { | ||
1041 | 'beforeselect' : this.onBeforeSelect | 1038 | 'beforeselect' : this.onBeforeSelect |
1042 | } | 1039 | } |
1043 | } | 1040 | } |
1044 | - | 1041 | + |
1045 | ]; | 1042 | ]; |
1046 | }, | 1043 | }, |
1047 | - | 1044 | + |
1048 | createInfoPanel : function() | 1045 | createInfoPanel : function() |
1049 | { | 1046 | { |
1050 | var me = this; | 1047 | var me = this; |
@@ -1080,21 +1077,21 @@ Ext.define('amdaUI.FiltersUI', { | @@ -1080,21 +1077,21 @@ Ext.define('amdaUI.FiltersUI', { | ||
1080 | ] | 1077 | ] |
1081 | }; | 1078 | }; |
1082 | }, | 1079 | }, |
1083 | - | 1080 | + |
1084 | createGridPanel : function() | 1081 | createGridPanel : function() |
1085 | { | 1082 | { |
1086 | this.grid = Ext.create('amdaUI.FilterGridPanel',{}); | 1083 | this.grid = Ext.create('amdaUI.FilterGridPanel',{}); |
1087 | return this.grid; | 1084 | return this.grid; |
1088 | }, | 1085 | }, |
1089 | - | ||
1090 | - init : function(config) | 1086 | + |
1087 | + init : function(config) | ||
1091 | { | 1088 | { |
1092 | var me = this; | 1089 | var me = this; |
1093 | - | 1090 | + |
1094 | var myConf = { | 1091 | var myConf = { |
1095 | layout: 'border', | 1092 | layout: 'border', |
1096 | tbar : this.createToolBar(), | 1093 | tbar : this.createToolBar(), |
1097 | - items: [ | 1094 | + items: [ |
1098 | { | 1095 | { |
1099 | xtype : 'panel', | 1096 | xtype : 'panel', |
1100 | region: 'center', | 1097 | region: 'center', |
@@ -1107,10 +1104,10 @@ Ext.define('amdaUI.FiltersUI', { | @@ -1107,10 +1104,10 @@ Ext.define('amdaUI.FiltersUI', { | ||
1107 | items : [ | 1104 | items : [ |
1108 | this.createInfoPanel(), | 1105 | this.createInfoPanel(), |
1109 | this.createGridPanel() | 1106 | this.createGridPanel() |
1110 | - ] | 1107 | + ] |
1111 | }, | 1108 | }, |
1112 | { | 1109 | { |
1113 | - xtype: 'panel', | 1110 | + xtype: 'panel', |
1114 | region: 'south', | 1111 | region: 'south', |
1115 | title: 'Information', | 1112 | title: 'Information', |
1116 | collapsible: true, | 1113 | collapsible: true, |
@@ -1121,12 +1118,12 @@ Ext.define('amdaUI.FiltersUI', { | @@ -1121,12 +1118,12 @@ Ext.define('amdaUI.FiltersUI', { | ||
1121 | loader: { | 1118 | loader: { |
1122 | autoLoad: true, | 1119 | autoLoad: true, |
1123 | url: helpDir+'filterHOWTO' | 1120 | url: helpDir+'filterHOWTO' |
1124 | - } | 1121 | + } |
1125 | } | 1122 | } |
1126 | ] | 1123 | ] |
1127 | }; | 1124 | }; |
1128 | Ext.apply (me , Ext.apply (arguments, myConf)); | 1125 | Ext.apply (me , Ext.apply (arguments, myConf)); |
1129 | - | 1126 | + |
1130 | this.filtersInfoStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterInfo'}); | 1127 | this.filtersInfoStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterInfo'}); |
1131 | this.filtersListStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterSelectList'}); | 1128 | this.filtersListStore = Ext.create('Ext.data.Store',{model: 'amdaModel.FilterSelectList'}); |
1132 | 1129 | ||
@@ -1138,7 +1135,7 @@ Ext.define('amdaUI.FiltersUI', { | @@ -1138,7 +1135,7 @@ Ext.define('amdaUI.FiltersUI', { | ||
1138 | this.filtersListStore.load({ | 1135 | this.filtersListStore.load({ |
1139 | scope : me, | 1136 | scope : me, |
1140 | callback: function(records, operation, success) | 1137 | callback: function(records, operation, success) |
1141 | - { | 1138 | + { |
1142 | me.grid.setFiltersListStore(this.filtersListStore); | 1139 | me.grid.setFiltersListStore(this.filtersListStore); |
1143 | } | 1140 | } |
1144 | }); | 1141 | }); |