Mercurial > lada > lada-client
annotate app/view/grid/Ortszuordnung.js @ 1285:0120a72b3690
removed an old message in Messprogramm
author | Maximilian Krambach <mkrambach@intevation.de> |
---|---|
date | Thu, 26 Jan 2017 10:51:24 +0100 |
parents | a792eecf1614 |
children | bfdc00c24baf |
rev | line source |
---|---|
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 * Software engineering by Intevation GmbH |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 * |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 * This file is Free Software under the GNU GPL (v>=3) |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 * the documentation coming with IMIS-Labordaten-Application for details. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
7 */ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 |
893
07dfcdf5b41f
jsduck for grids and panels
Dustin Demuth <dustin@intevation.de>
parents:
824
diff
changeset
|
9 /** |
1004
9ac03f461ab4
Introduced Orte into Stammdatengrids, Added Ortszuordnung. THIS COMMIT IS WORK IN PROGRESS, Proben will NOT work after this commit. Orte can not be edited.
Dustin Demuth <dustin@intevation.de>
parents:
893
diff
changeset
|
10 * Grid to list Ortszuordnungen |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 */ |
1004
9ac03f461ab4
Introduced Orte into Stammdatengrids, Added Ortszuordnung. THIS COMMIT IS WORK IN PROGRESS, Proben will NOT work after this commit. Orte can not be edited.
Dustin Demuth <dustin@intevation.de>
parents:
893
diff
changeset
|
12 Ext.define('Lada.view.grid.Ortszuordnung', { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 extend: 'Ext.grid.Panel', |
1012
2adc329d90fe
Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents:
1004
diff
changeset
|
14 alias: 'widget.ortszuordnunggrid', |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
15 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 maxHeight: 350, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 emptyText: 'Keine Orte gefunden.', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 // minHeight and deferEmptyText are needed to be able to show the |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 // emptyText message. |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 minHeight: 110, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
21 viewConfig: { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
22 deferEmptyText: false |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
23 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
24 margin: '0, 5, 5, 5', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
25 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
26 recordId: null, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
27 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
28 warnings: null, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
29 errors: null, |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
30 readOnly: true, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
31 allowDeselect: true, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
32 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
33 initComponent: function() { |
1264
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
34 var me = this; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
35 this.dockedItems = [{ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
36 xtype: 'toolbar', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
37 dock: 'bottom', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
38 items: ['->', { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
39 text: 'Hinzufügen', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 icon: 'resources/img/list-add.png', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 action: 'add', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
42 probeId: this.probeId |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
43 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
44 text: 'Löschen', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 icon: 'resources/img/list-remove.png', |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 action: 'delete' |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
47 }] |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
48 }]; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
49 this.columns = [{ |
1257
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
50 xtype: 'actioncolumn', |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
51 text: '', |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
52 dataIndex: 'readonly', |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
53 sortable: false, |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
54 width: 30, |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
55 getClass: function (val, meta, rec) { |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
56 if (rec.get('readonly') === false) { |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
57 return 'edit'; |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
58 } |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
59 return 'noedit'; |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
60 }, |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
61 handler: function(grid, rowIndex, colIndex) { |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
62 var rec = grid.getStore().getAt(rowIndex); |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
63 grid.fireEvent('itemdblclick', grid, rec); |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
64 } |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
65 }, { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
66 header: 'Typ', |
1012
2adc329d90fe
Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents:
1004
diff
changeset
|
67 dataIndex: 'ortszuordnungTyp', |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1012
diff
changeset
|
68 flex: 1, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
69 editor: { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
70 allowBlank: false |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
71 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
72 }, { |
1257
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
73 header: 'Ort-ID', |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
74 dataIndex: 'ortId', |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
75 flex: 2, |
1274
a792eecf1614
Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1264
diff
changeset
|
76 renderer: function(value, meta, zuordnung) { |
1257
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
77 var store = Ext.data.StoreManager.get('orte'); |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
78 var record = store.getById(value); |
1264
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
79 if (!record) { |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
80 record = Ext.create('Lada.model.Ort'); |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
81 record.set('id', value); |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
82 store.add(record); |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
83 Lada.model.Ort.load(value, { |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
84 success: function(rec) { |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
85 record.beginEdit(); |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
86 for (key in rec.getData()) { |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
87 record.set(key, rec.getData()[key]); |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
88 } |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
89 record.endEdit(); |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
90 me.getView().refresh(); |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
91 } |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
92 }); |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
93 } |
1257
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
94 return record.get('ortId'); |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
95 } |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
96 }, { |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
97 header: 'Staat', |
1012
2adc329d90fe
Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents:
1004
diff
changeset
|
98 dataIndex: 'ortId', |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1012
diff
changeset
|
99 flex: 1, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 renderer: function(value) { |
1004
9ac03f461ab4
Introduced Orte into Stammdatengrids, Added Ortszuordnung. THIS COMMIT IS WORK IN PROGRESS, Proben will NOT work after this commit. Orte can not be edited.
Dustin Demuth <dustin@intevation.de>
parents:
893
diff
changeset
|
101 var store = Ext.data.StoreManager.get('orte'); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 var staaten = Ext.data.StoreManager.get('staaten'); |
1264
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
103 var ortRecord = store.getById(value); |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
104 if (!ortRecord || ortRecord.get('staatId') === '') { |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
105 return ''; |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
106 } |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
107 var record = staaten.getById(ortRecord.get('staatId')); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 return record.get('staatIso'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
109 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 }, { |
1012
2adc329d90fe
Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents:
1004
diff
changeset
|
111 header: 'Gemeindeschlüssel', |
2adc329d90fe
Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents:
1004
diff
changeset
|
112 dataIndex: 'ortId', |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1012
diff
changeset
|
113 flex: 3, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 renderer: function(value) { |
1004
9ac03f461ab4
Introduced Orte into Stammdatengrids, Added Ortszuordnung. THIS COMMIT IS WORK IN PROGRESS, Proben will NOT work after this commit. Orte can not be edited.
Dustin Demuth <dustin@intevation.de>
parents:
893
diff
changeset
|
115 var store = Ext.data.StoreManager.get('orte'); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 var record = store.getById(value); |
1264
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
117 if (!record || record.get('gemId') === '') { |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
118 return ''; |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
119 } |
1004
9ac03f461ab4
Introduced Orte into Stammdatengrids, Added Ortszuordnung. THIS COMMIT IS WORK IN PROGRESS, Proben will NOT work after this commit. Orte can not be edited.
Dustin Demuth <dustin@intevation.de>
parents:
893
diff
changeset
|
120 return record.get('gemId'); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 }, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 header: 'Gemeindename', |
1012
2adc329d90fe
Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents:
1004
diff
changeset
|
124 dataIndex: 'ortId', |
1021
1df6b6210b42
WIP First Version of a New Window/Panel combination to edit Ortszuordnungen and Orte
Dustin Demuth <dustin@intevation.de>
parents:
1012
diff
changeset
|
125 flex: 4, |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
126 renderer: function(value) { |
1004
9ac03f461ab4
Introduced Orte into Stammdatengrids, Added Ortszuordnung. THIS COMMIT IS WORK IN PROGRESS, Proben will NOT work after this commit. Orte can not be edited.
Dustin Demuth <dustin@intevation.de>
parents:
893
diff
changeset
|
127 var store = Ext.data.StoreManager.get('orte'); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 var gemeinden = |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 Ext.data.StoreManager.get('verwaltungseinheiten'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
130 var record = store.getById(value); |
1264
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
131 if (!record || record.get('gemId') === '') { |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
132 return ''; |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
133 } |
1004
9ac03f461ab4
Introduced Orte into Stammdatengrids, Added Ortszuordnung. THIS COMMIT IS WORK IN PROGRESS, Proben will NOT work after this commit. Orte can not be edited.
Dustin Demuth <dustin@intevation.de>
parents:
893
diff
changeset
|
134 var gemid = record.get('gemId'); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 var record2 = gemeinden.getById(gemid); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
136 return record2.get('bezeichnung'); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
137 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
138 }, { |
1257
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
139 header: 'Anlage', |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
140 dataIndex: 'ortId', |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
141 flex: 3, |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
142 renderer: function(value) { |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
143 var store = Ext.data.StoreManager.get('orte'); |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
144 var record = store.getById(value); |
1264
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
145 if (!record || record.get('anlageId') === '') { |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
146 return ''; |
3d83bcb02ee3
Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1257
diff
changeset
|
147 } |
1257
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
148 return record.get('anlageId'); |
9a428be3907b
add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents:
1051
diff
changeset
|
149 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
150 }]; |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
151 this.listeners = { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
152 select: { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
153 fn: this.activateRemoveButton, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
154 scope: this |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
155 }, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
156 deselect: { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
157 fn: this.deactivateRemoveButton, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
158 scope: this |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
159 } |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
160 }; |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 this.initData(); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 this.callParent(arguments); |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
163 this.setReadOnly(true); //Grid is always initialised as RO |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
165 |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 initData: function() { |
1004
9ac03f461ab4
Introduced Orte into Stammdatengrids, Added Ortszuordnung. THIS COMMIT IS WORK IN PROGRESS, Proben will NOT work after this commit. Orte can not be edited.
Dustin Demuth <dustin@intevation.de>
parents:
893
diff
changeset
|
167 this.store = Ext.create('Lada.store.Ortszuordnung'); |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 this.store.load({ |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 params: { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 probeId: this.recordId |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
173 Ext.ClassManager.get('Lada.model.Probe').load(this.recordId, { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
174 failure: function(record, action) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
175 // TODO |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
176 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
177 success: function(record, response) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
178 var json = Ext.decode(response.response.responseText); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 if (json) { |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 this.warnings = json.warnings; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 this.errors = json.errors; |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
182 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 scope: this |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
185 }); |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
186 }, |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
187 |
684
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
188 setReadOnly: function(b) { |
1034
4d4de99bbe53
Get rid of double setting readOnly status of probe window child elements.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1004
diff
changeset
|
189 this.readOnly = b; |
4d4de99bbe53
Get rid of double setting readOnly status of probe window child elements.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1004
diff
changeset
|
190 if (b) { |
684
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
191 //Readonly |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
192 if (this.getPlugin('rowedit')) { |
684
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
193 this.getPlugin('rowedit').disable(); |
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
194 } |
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
195 this.down('button[action=delete]').disable(); |
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
196 this.down('button[action=add]').disable(); |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
197 } |
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
198 else { |
684
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
199 //Writable |
1035
479782c96efa
Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
1034
diff
changeset
|
200 if (this.getPlugin('rowedit')) { |
684
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
201 this.getPlugin('rowedit').enable(); |
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
202 } |
824
fab0b7be5aca
add disbled remove button to all grids which relate to proben or messungen. Messprogramme-grids are untouched. BUG: When the last entry is deleted, the button remains active
Dustin Demuth <dustin@intevation.de>
parents:
823
diff
changeset
|
203 //this.down('button[action=delete]').enable(); |
684
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
204 this.down('button[action=add]').enable(); |
69cb367c0a63
When a Probeform is dirty, all child-grids are made readonly (Row Editing is not disbled correctly). When a Probe is read-only all Child-grid buttons are disabled. When a Probe is ReadOnly probeform is also readonly.
Dustin Demuth <dustin@intevation.de>
parents:
600
diff
changeset
|
205 } |
823
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
206 }, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
207 /** |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
208 * Activate the Remove Button |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
209 */ |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
210 activateRemoveButton: function(selection, record) { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
211 var grid = this; |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
212 //only enable the remove buttone, when the grid is editable. |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
213 if (! grid.readOnly) { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
214 grid.down('button[action=delete]').enable(); |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
215 } |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
216 }, |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
217 /** |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
218 * Activate the Remove Button |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
219 */ |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
220 deactivateRemoveButton: function(selection, record) { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
221 var grid = this; |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
222 //only enable the remove buttone, when the grid is editable. |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
223 if (! grid.readOnly) { |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
224 grid.down('button[action=delete]').disable(); |
5ed0e6273888
Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents:
684
diff
changeset
|
225 } |
548
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
226 } |
d47ee7439f44
Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
227 }); |