annotate app/view/grid/Ortszuordnung.js @ 1349:c05a5534f0d9

anlageId can be null. Rendering of a grid entry failed if this was the case.
author Tom Gottfried <tom@intevation.de>
date Tue, 07 Feb 2017 12:48:20 +0100
parents 8742d020c685
children 036c594de978
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
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
28 isMessprogramm: false,
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
29
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 warnings: null,
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 errors: null,
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
32 readOnly: true,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
33 allowDeselect: true,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 initComponent: function() {
1264
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
36 var me = this;
1299
394c722e5402 Use i18n instead of hardcoded strings for Ortszuordnung-grid.
Tom Gottfried <tom@intevation.de>
parents: 1289
diff changeset
37 var i18n = Lada.getApplication().bundle;
394c722e5402 Use i18n instead of hardcoded strings for Ortszuordnung-grid.
Tom Gottfried <tom@intevation.de>
parents: 1289
diff changeset
38
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 this.dockedItems = [{
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 xtype: 'toolbar',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 dock: 'bottom',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 items: ['->', {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 text: 'Hinzufügen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 icon: 'resources/img/list-add.png',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45 action: 'add',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46 probeId: this.probeId
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 text: 'Löschen',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 icon: 'resources/img/list-remove.png',
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 action: 'delete'
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 }]
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 }];
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53 this.columns = [{
1257
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
54 xtype: 'actioncolumn',
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
55 text: '',
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
56 dataIndex: 'readonly',
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
57 sortable: false,
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
58 width: 30,
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
59 getClass: function (val, meta, rec) {
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
60 if (rec.get('readonly') === false) {
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
61 return 'edit';
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
62 }
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
63 return 'noedit';
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 handler: function(grid, rowIndex, colIndex) {
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
66 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
67 grid.fireEvent('itemdblclick', grid, rec);
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
68 }
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
69 }, {
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 header: 'Typ',
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 1004
diff changeset
71 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
72 flex: 1,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 editor: {
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 allowBlank: false
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 }, {
1299
394c722e5402 Use i18n instead of hardcoded strings for Ortszuordnung-grid.
Tom Gottfried <tom@intevation.de>
parents: 1289
diff changeset
77 header: i18n.getMsg('orte.ortId'),
1257
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
78 dataIndex: 'ortId',
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
79 flex: 2,
1274
a792eecf1614 Updated Layout and Map for 'ortsbezug'-window. WIP!
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1264
diff changeset
80 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
81 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
82 var record = store.getById(value);
1264
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
83 if (!record) {
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
84 record = Ext.create('Lada.model.Ort');
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
85 record.set('id', value);
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
86 store.add(record);
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
87 Lada.model.Ort.load(value, {
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
88 success: function(rec) {
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
89 record.beginEdit();
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
90 for (key in rec.getData()) {
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
91 record.set(key, rec.getData()[key]);
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 record.endEdit();
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
94 me.getView().refresh();
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
95 }
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
96 });
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
97 }
1257
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
98 return record.get('ortId');
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
99 }
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
100 }, {
1299
394c722e5402 Use i18n instead of hardcoded strings for Ortszuordnung-grid.
Tom Gottfried <tom@intevation.de>
parents: 1289
diff changeset
101 header: i18n.getMsg('staat'),
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 1004
diff changeset
102 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
103 flex: 1,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 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
105 var store = Ext.data.StoreManager.get('orte');
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 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
107 var ortRecord = store.getById(value);
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
108 if (!ortRecord || ortRecord.get('staatId') === '') {
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
109 return '';
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
110 }
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
111 var record = staaten.getById(ortRecord.get('staatId'));
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
112 return record.get('staatIso');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
113 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
114 }, {
1299
394c722e5402 Use i18n instead of hardcoded strings for Ortszuordnung-grid.
Tom Gottfried <tom@intevation.de>
parents: 1289
diff changeset
115 header: i18n.getMsg('orte.gemId'),
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 1004
diff changeset
116 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
117 flex: 3,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 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
119 var store = Ext.data.StoreManager.get('orte');
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 var record = store.getById(value);
1264
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
121 if (!record || record.get('gemId') === '') {
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
122 return '';
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
123 }
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
124 return record.get('gemId');
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
126 }, {
1299
394c722e5402 Use i18n instead of hardcoded strings for Ortszuordnung-grid.
Tom Gottfried <tom@intevation.de>
parents: 1289
diff changeset
127 header: i18n.getMsg('orte.verwaltungseinheit'),
1012
2adc329d90fe Replaced Locations with Ortszuordnung
Dustin Demuth <dustin@intevation.de>
parents: 1004
diff changeset
128 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
129 flex: 4,
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
130 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
131 var store = Ext.data.StoreManager.get('orte');
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 var gemeinden =
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 Ext.data.StoreManager.get('verwaltungseinheiten');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
134 var record = store.getById(value);
1264
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
135 if (!record || record.get('gemId') === '') {
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
136 return '';
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
137 }
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
138 var gemid = record.get('gemId');
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
139 var record2 = gemeinden.getById(gemid);
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
140 return record2.get('bezeichnung');
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 }, {
1299
394c722e5402 Use i18n instead of hardcoded strings for Ortszuordnung-grid.
Tom Gottfried <tom@intevation.de>
parents: 1289
diff changeset
143 header: i18n.getMsg('orte.anlageId'),
1257
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
144 dataIndex: 'ortId',
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
145 flex: 3,
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
146 renderer: function(value) {
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
147 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
148 var record = store.getById(value);
1349
c05a5534f0d9 anlageId can be null.
Tom Gottfried <tom@intevation.de>
parents: 1346
diff changeset
149 if (!record || !record.get('anlageId')) {
1264
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
150 return '';
3d83bcb02ee3 Load unknown ort and refresh ortzuordnungs grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1257
diff changeset
151 }
1346
8742d020c685 Get kta code to display the correct value in ortszuordnung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
152 var ktas = Ext.data.StoreManager.get('ktas');
8742d020c685 Get kta code to display the correct value in ortszuordnung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
153 var kta = ktas.getById(record.get('anlageId'));
8742d020c685 Get kta code to display the correct value in ortszuordnung grid.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1339
diff changeset
154 return kta.get('code');
1257
9a428be3907b add action button in Messung grid and Ortszuordnung grid
Michael Stanko <mstanko@bfs.de>
parents: 1051
diff changeset
155 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156 }];
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
157 this.listeners = {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
158 select: {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
159 fn: this.activateRemoveButton,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
160 scope: this
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
161 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
162 deselect: {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
163 fn: this.deactivateRemoveButton,
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
164 scope: this
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
165 }
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
166 };
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 this.initData();
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 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
169 this.setReadOnly(true); //Grid is always initialised as RO
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
170 },
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 initData: function() {
1339
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
173 var modelname;
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
174 if (this.isMessprogramm) {
1339
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
175 this.store = Ext.create('Lada.store.OrtszuordnungMp');
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
176 this.store.load({
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
177 params: {
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
178 messprogrammId: this.recordId
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
179 }});
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
180 modelname = 'Lada.model.Messprogramm';
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
181 } else {
1339
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
182 modelname = 'Lada.model.Probe';
1289
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
183 this.store = Ext.create('Lada.store.Ortszuordnung');
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
184 this.store.load({
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
185 params: {
bfdc00c24baf Ortszuordnung for messprogramm and probe using same form
Maximilian Krambach <mkrambach@intevation.de>
parents: 1274
diff changeset
186 probeId: this.recordId
1339
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
187 }});
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
188 }
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
189 Ext.ClassManager.get(modelname).load(this.recordId, {
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
190 failure: function(record, action) {
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
191 // TODO
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
192 },
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
193 success: function(record, response) {
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
194 var json = Ext.decode(response.response.responseText);
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
195 if (json) {
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
196 this.warnings = json.warnings;
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
197 this.errors = json.errors;
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
198 }
1339
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
199 },
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
200 scope: this
1a2cd9bef6d7 messprogramm zuordnung now functional
Maximilian Krambach <mkrambach@intevation.de>
parents: 1299
diff changeset
201 });
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
202 },
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
203
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 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
205 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
206 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
207 //Readonly
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
208 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
209 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
210 }
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
211 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
212 this.down('button[action=add]').disable();
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
213 }
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
214 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
215 //Writable
1035
479782c96efa Code style.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 1034
diff changeset
216 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
217 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
218 }
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
219 //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
220 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
221 }
823
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
222 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
223 /**
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
224 * 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
225 */
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
226 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
227 var grid = this;
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
228 //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
229 if (! grid.readOnly) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
230 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
231 }
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
232 },
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
233 /**
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
234 * 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
235 */
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
236 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
237 var grid = this;
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
238 //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
239 if (! grid.readOnly) {
5ed0e6273888 Only enable delete button in grids when an entry was selected
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
240 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
241 }
548
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
242 }
d47ee7439f44 Added new js files.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
243 });

http://lada.wald.intevation.org