Mercurial > lada > lada-client
comparison app/controller/grid/MessprogrammeList.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 | |
children | 56470a075e6e |
comparison
equal
deleted
inserted
replaced
974:ea477f62a667 | 975:fb99332bb48e |
---|---|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out | |
6 * the documentation coming with IMIS-Labordaten-Application for details. | |
7 */ | |
8 | |
9 /** | |
10 * Controller for filter result grid. | |
11 */ | |
12 Ext.define('Lada.controller.grid.MessprogrammeList', { | |
13 extend: 'Ext.app.Controller', | |
14 requires: [ | |
15 'Lada.view.window.Messprogramm', | |
16 'Lada.view.window.GenProbenFromMessprogramm' | |
17 ], | |
18 | |
19 /** | |
20 * Initialize the Controller with listeners | |
21 */ | |
22 init: function() { | |
23 this.control({ | |
24 'messprogrammelistgrid': { | |
25 itemdblclick: this.editItem | |
26 }, | |
27 'messprogrammelistgrid toolbar button[action=addMessprogramm]': { | |
28 click: this.addMessprogrammItem | |
29 }, | |
30 'messprogrammelistgrid toolbar button[action=genProbenFromMessprogramm]': { | |
31 click: this.genProbenFromMessprogramm | |
32 } | |
33 }); | |
34 this.callParent(arguments); | |
35 }, | |
36 | |
37 /** | |
38 * This function is called after a Row in the | |
39 * {@link Lada.view.grid.MessprogrammeList} | |
40 * was double-clicked. | |
41 * The function opens a {@link Lada.view.window.ProbeEdit} | |
42 * or a {@link Lada.view.window.Messprogramm}. | |
43 * To determine which window has to be opened, the function | |
44 * analyse the records modelname. | |
45 */ | |
46 editItem: function(grid, record) { | |
47 var winname = 'Lada.view.window.Messprogramm'; | |
48 var win = Ext.create(winname, { | |
49 record: record, | |
50 style: 'z-index: -1;' //Fixes an Issue where windows could not be created in IE8 | |
51 }); | |
52 win.show(); | |
53 win.initData(); | |
54 }, | |
55 | |
56 /** | |
57 * This function opens a new window to create a Probe | |
58 * {@link Lada.view.window.Messprogramm} | |
59 */ | |
60 addMessprogrammItem: function() { | |
61 var win = Ext.create('Lada.view.window.Messprogramm'); | |
62 win.show(); | |
63 win.initData(); | |
64 }, | |
65 | |
66 /** | |
67 * This button creates a window to generate Proben | |
68 * from a selected messprogramm. | |
69 */ | |
70 genProbenFromMessprogramm: function(button) { | |
71 var grid = button.up('grid'); | |
72 var selection = grid.getView().getSelectionModel().getSelection(); | |
73 var i18n = Lada.getApplication().bundle; | |
74 var proben = []; | |
75 for (var i = 0; i < selection.length; i++) { | |
76 proben.push(selection[i].get('id')); | |
77 } | |
78 var me = this; | |
79 | |
80 var winname = 'Lada.view.window.GenProbenFromMessprogramm'; | |
81 for (p in proben) { | |
82 grid.setLoading(true); | |
83 Ext.ClassManager.get('Lada.model.Messprogramm').load(proben[p], { | |
84 failure: function(record, action) { | |
85 me.setLoading(false); | |
86 // TODO | |
87 console.log('An unhandled Failure occured. See following Response and Record'); | |
88 console.log(action); | |
89 console.log(record); | |
90 }, | |
91 success: function(record, response) { | |
92 grid.setLoading(false); | |
93 | |
94 var win = Ext.create(winname, { | |
95 record: record, | |
96 parentWindow: null | |
97 }); | |
98 win.show(); | |
99 win.initData(); | |
100 }, | |
101 scope: this | |
102 }); | |
103 } | |
104 }, | |
105 | |
106 reload: function(btn) { | |
107 if (btn === 'yes') { | |
108 location.reload(); | |
109 } | |
110 } | |
111 }); | |
112 |