comparison app/controller/ProbenPlanungSwitcher.js @ 975:fb99332bb48e stammdatengrids

Severe changes concerning the Resultgrids. - Intrduced "Stammdaten" which can be selected in the Mode Field on the left side, - Added Stores and Models for the Stammdaten - Removed the FilterResultgrid and replaced it with a model which uses inheritance. Dynamic Grid Columns can now be derived from app/view/widget/DynamicGrid.js For Proben and Messprogramme this is already done. - There might be some REGRESSION concerning the buttons in the ProbeList and MessprogrammeList grid, as those are not disabled properly. This needs to be fixed in future commits.
author Dustin Demuth <dustin@intevation.de>
date Wed, 02 Dec 2015 17:39:04 +0100
parents 96e04c258b8f
children
comparison
equal deleted inserted replaced
974:ea477f62a667 975:fb99332bb48e
14 extend: 'Ext.app.Controller', 14 extend: 'Ext.app.Controller',
15 displayFields: null, 15 displayFields: null,
16 16
17 requires: [ 17 requires: [
18 'Lada.store.MessprogrammQueries', 18 'Lada.store.MessprogrammQueries',
19 'Lada.store.ProbeQueries' 19 'Lada.store.ProbeQueries',
20 'Lada.store.StammdatenQueries'
20 ], 21 ],
21 22
22 /** 23 /**
23 * Initialize this Controller 24 * Initialize this Controller
24 * It has 1 Listeners 25 * It has 1 Listeners
36 /** 37 /**
37 * Function is called when the user selects a checkbox. 38 * Function is called when the user selects a checkbox.
38 * according to the checkboxes inputValue, 39 * according to the checkboxes inputValue,
39 * the function alters the store which was loaded by the 40 * the function alters the store which was loaded by the
40 * filterpanels combobox, 41 * filterpanels combobox,
41 * If enabled the function also disables / enables the UI-Buttons
42 * in the Filterresult grid.
43 */ 42 */
44 switchModes: function(field) { 43 switchModes: function(field) {
45
46 var disableButtons = true;
47 var cbox = field.up('probenplanungswitcher').up().down('combobox'); 44 var cbox = field.up('probenplanungswitcher').up().down('combobox');
48 var resultGrid = field.up('panel[name=main]').down('filterresultgrid');
49 filters = field.up('panel[name=main]').down('fieldset[name=filtervariables]'); 45 filters = field.up('panel[name=main]').down('fieldset[name=filtervariables]');
50 filters.removeAll(); 46 filters.removeAll();
51 filters.hide(); 47 filters.hide();
52 var sname = 'Lada.store.ProbeQueries'; 48
53 var gridsname = 'Lada.store.ProbenList'; 49 //Initialise variables which will define the querystore
54 if (field.inputValue === 'MessprogrammList' && cbox) { 50 // and the store which has to be loaded into the grid.
55 sname = 'Lada.store.MessprogrammQueries'; 51 var querystorename = '';
56 gridsname = 'Lada.store.MessprogrammeList'; 52
53 // In dependence of the checkboxes input value,
54 // define the store of the filter.
55 // app/controller/Filter.js contains similar code.
56 if (field.inputValue === 'messprogramme' && cbox) {
57 querystorename = 'Lada.store.MessprogrammQueries';
57 } 58 }
58 else if (field.inputValue === 'ProbeList' && cbox) { 59 else if (field.inputValue === 'proben' && cbox) {
59 sname = 'Lada.store.ProbeQueries'; 60 querystorename = 'Lada.store.ProbeQueries';
60 gridsname = 'Lada.store.ProbenList'; 61 }
62 else if (field.inputValue === 'stammdaten' && cbox) {
63 querystorename = 'Lada.store.StammdatenQueries';
61 } 64 }
62 65
66 if (querystorename) {
67 var store = Ext.StoreManager.lookup(querystorename);
63 68
64 var store = Ext.StoreManager.lookup(sname); 69 if (!store) {
70 store = Ext.create(querystorename, {
71 //Select first Item on Load
72 listeners: {
73 load: function(store){
74 var records = new Array();
75 records.push(store.getAt(0));
65 76
66 if (!store) { 77 cbox.select(records[0]);
67 store = Ext.create(sname, { 78 cbox.fireEvent('select', cbox, records);
68 //Select first Item on Load 79 }
69 listeners: { 80 }
70 load: function(s){ 81 });
71 var records = new Array(); 82 }
72 records.push(store.getAt(0));
73 83
74 cbox.select(records[0]); 84 if (store) {
75 cbox.fireEvent('select', cbox, records); 85 if (!store.autoLoad) {
76 } 86 store.load();
77 } 87 }
78 }); 88 //cbox.reset();
89 cbox.bindStore(store);
90 }
79 } 91 }
80 if (store) {
81 store.load();
82 cbox.reset();
83 cbox.bindStore(store);
84 }
85
86 var gridstore = Ext.StoreManager.lookup(gridsname);
87 if (!gridstore) {
88 gridstore = Ext.create(gridsname);
89 }
90 if (gridstore) {
91 resultGrid.setStore(gridstore);
92 resultGrid.show();
93 }
94
95 } 92 }
96 }); 93 });

http://lada.wald.intevation.org