annotate app/view/grid/Status.js @ 967:50d7b6e17525

Filter the selectable Messtellen in the statusgrid
author Dustin Demuth <dustin@intevation.de>
date Thu, 12 Nov 2015 14:51:25 +0100
parents a2c2039bb5d9
children 8fabf9a3fee7
rev   line source
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 /* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2 * Software engineering by Intevation GmbH
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 *
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 * This file is Free Software under the GNU GPL (v>=3)
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY! Check out
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 * the documentation coming with IMIS-Labordaten-Application for details.
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7 */
89b337cbfb5d Added status grid and controller.
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 /**
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 * Grid to list Status
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11 */
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12 Ext.define('Lada.view.grid.Status', {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 extend: 'Ext.grid.Panel',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 alias: 'widget.statusgrid',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 maxHeight: 350,
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 emptyText: 'Keine Statusangaben gefunden.',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 minHeight: 110,
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 viewConfig: {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20 deferEmptyText: false
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 },
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 recordId: null,
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: 799
diff changeset
24 readOnly: true,
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: 799
diff changeset
25 allowDeselect: true,
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 initComponent: function() {
963
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
28 var statusWerteStore = Ext.create('Lada.store.StatusWerte');
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
29 statusWerteStore.load({
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
30 params: {
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
31 messungsId: this.recordId
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
32 }
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
33 });
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
34 var statusStufeStore = Ext.create('Lada.store.StatusStufe');
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
35 statusStufeStore.load();
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
36
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38 clicksToMoveEditor: 1,
683
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 663
diff changeset
39 autoCancel: false,
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 944
diff changeset
40 disabled: true,
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: 683
diff changeset
41 pluginId: 'rowedit',
683
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 663
diff changeset
42 listeners:{
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 663
diff changeset
43 // Make row ineditable when readonly is set to true
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 663
diff changeset
44 // Normally this would belong into a controller an not the view.
703
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
45 // But the RowEditPlugin is not handled there.
683
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 663
diff changeset
46 beforeedit: function(e, o) {
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 944
diff changeset
47 var readonlywin = o.grid.up('window').record.get('readonly');
703
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
48 var readonlygrid = o.record.get('readonly');
9ab7b1eed9f8 Rowediting is now disabled when the Grid was set to ReadOnly
Dustin Demuth <dustin@intevation.de>
parents: 684
diff changeset
49 if (readonlywin == true || readonlygrid == true || this.disabled) {
683
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 663
diff changeset
50 return false;
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 663
diff changeset
51 }
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 663
diff changeset
52 return true;
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 663
diff changeset
53 }
612f4f933083 Made Grid-Rows uneditable if the dataset contains readonly=true. This only affects the Grids using the RowEdit Plugin
Dustin Demuth <dustin@intevation.de>
parents: 663
diff changeset
54 }
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 944
diff changeset
55 });
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 this.plugins = [this.rowEditing];
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 this.dockedItems = [{
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 xtype: 'toolbar',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 dock: 'bottom',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61 items: ['->', {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 text: 'Hinzufügen',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 icon: 'resources/img/list-add.png',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64 action: 'add',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65 probeId: this.probeId,
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 parentId: this.parentId
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 }]
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 }];
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 this.columns = [{
944
1f1467713c3f Status grid modified
Michael Stanko <mstanko@bfs.de>
parents: 893
diff changeset
70 header: 'erstellt',
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 944
diff changeset
71 dataIndex: 'datum',
944
1f1467713c3f Status grid modified
Michael Stanko <mstanko@bfs.de>
parents: 893
diff changeset
72 xtype: 'datecolumn',
1f1467713c3f Status grid modified
Michael Stanko <mstanko@bfs.de>
parents: 893
diff changeset
73 format: 'd.m.Y H:i',
1f1467713c3f Status grid modified
Michael Stanko <mstanko@bfs.de>
parents: 893
diff changeset
74 width: 110,
965
a2c2039bb5d9 Disabled StatusGrid Edit when StatusEdit ist false, Load StatuswerteStore differently, removed a bunch of trailing commas
Dustin Demuth <dustin@intevation.de>
parents: 964
diff changeset
75 sortable: false
944
1f1467713c3f Status grid modified
Michael Stanko <mstanko@bfs.de>
parents: 893
diff changeset
76 }, {
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 header: 'Erzeuger',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 dataIndex: 'erzeuger',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 renderer: function(value) {
961
6f1cc3316e2d Intermediate Result. When creating a Messung a Statuswert will be set.
Dustin Demuth <dustin@intevation.de>
parents: 958
diff changeset
80 var r = '';
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 if (!value || value === '') {
961
6f1cc3316e2d Intermediate Result. When creating a Messung a Statuswert will be set.
Dustin Demuth <dustin@intevation.de>
parents: 958
diff changeset
82 r = 'Error';
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 }
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 var mstore = Ext.data.StoreManager.get('messstellen');
961
6f1cc3316e2d Intermediate Result. When creating a Messung a Statuswert will be set.
Dustin Demuth <dustin@intevation.de>
parents: 958
diff changeset
85 var item = mstore.getById(value);
6f1cc3316e2d Intermediate Result. When creating a Messung a Statuswert will be set.
Dustin Demuth <dustin@intevation.de>
parents: 958
diff changeset
86 if (item) {
6f1cc3316e2d Intermediate Result. When creating a Messung a Statuswert will be set.
Dustin Demuth <dustin@intevation.de>
parents: 958
diff changeset
87 r = item.get('messStelle');
6f1cc3316e2d Intermediate Result. When creating a Messung a Statuswert will be set.
Dustin Demuth <dustin@intevation.de>
parents: 958
diff changeset
88 }
6f1cc3316e2d Intermediate Result. When creating a Messung a Statuswert will be set.
Dustin Demuth <dustin@intevation.de>
parents: 958
diff changeset
89 return r;
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 },
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 editor: {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 xtype: 'combobox',
967
50d7b6e17525 Filter the selectable Messtellen in the statusgrid
Dustin Demuth <dustin@intevation.de>
parents: 965
diff changeset
93 store: Ext.data.StoreManager.get('messstellenFiltered'),
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 displayField: 'messStelle',
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 valueField: 'id',
663
1c5a4b419149 Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents: 630
diff changeset
96 allowBlank: false,
1c5a4b419149 Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents: 630
diff changeset
97 editable: false
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 944
diff changeset
98 },
965
a2c2039bb5d9 Disabled StatusGrid Edit when StatusEdit ist false, Load StatuswerteStore differently, removed a bunch of trailing commas
Dustin Demuth <dustin@intevation.de>
parents: 964
diff changeset
99 sortable: false
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 }, {
956
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 950
diff changeset
101 header: 'Stufe',
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 950
diff changeset
102 dataIndex: 'statusStufe',
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 950
diff changeset
103 renderer: function(value) {
963
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
104 var sta = Ext.data.StoreManager.get('statusstufe');
958
5d57c6c53e20 Made the grids more robust against erroneous data
Dustin Demuth <dustin@intevation.de>
parents: 957
diff changeset
105 var r;
957
881984972e0e Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents: 956
diff changeset
106 if (value===null || value === '') {
958
5d57c6c53e20 Made the grids more robust against erroneous data
Dustin Demuth <dustin@intevation.de>
parents: 957
diff changeset
107 r = 'Error';
956
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 950
diff changeset
108 }
963
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
109 var item = sta.getById(value);
957
881984972e0e Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents: 956
diff changeset
110 if (item) {
881984972e0e Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents: 956
diff changeset
111 r = item.get('stufe');
881984972e0e Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents: 956
diff changeset
112 }
956
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 950
diff changeset
113 return r;
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 950
diff changeset
114 },
965
a2c2039bb5d9 Disabled StatusGrid Edit when StatusEdit ist false, Load StatuswerteStore differently, removed a bunch of trailing commas
Dustin Demuth <dustin@intevation.de>
parents: 964
diff changeset
115 sortable: false
956
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 950
diff changeset
116 }, {
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
117 header: 'Status',
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 944
diff changeset
118 dataIndex: 'statusWert',
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 renderer: function(value) {
963
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
120 var sta = Ext.data.StoreManager.get('statuswerte');
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
121 //This store is NOT used in the editor...
958
5d57c6c53e20 Made the grids more robust against erroneous data
Dustin Demuth <dustin@intevation.de>
parents: 957
diff changeset
122 var r;
950
c7bf0b459074 Fixed some issues when the status is null
Dustin Demuth <dustin@intevation.de>
parents: 945
diff changeset
123 if (value===null || value === '') {
958
5d57c6c53e20 Made the grids more robust against erroneous data
Dustin Demuth <dustin@intevation.de>
parents: 957
diff changeset
124 r = 'Error';
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
125 }
963
6a6f2c6fe8ee More work done on StatusWerte and Statusstufe. A Messung will also open when the owner attribute is true. Stauswerte and StatusStufen are loaded at application startup. Statusgrid and Messunggrid now use these stores, which were registered at the store manager.
Dustin Demuth <dustin@intevation.de>
parents: 961
diff changeset
126 var item = sta.getById(value);
957
881984972e0e Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents: 956
diff changeset
127 if (item) {
881984972e0e Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents: 956
diff changeset
128 r = item.get('wert');
881984972e0e Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents: 956
diff changeset
129 }
956
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 950
diff changeset
130 return r;
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
131 },
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
132 editor: {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
133 xtype: 'combobox',
956
45c67a784b31 Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents: 950
diff changeset
134 store: statusWerteStore,
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 944
diff changeset
135 displayField: 'wert',
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
136 valueField: 'id',
663
1c5a4b419149 Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents: 630
diff changeset
137 allowBlank: false,
1c5a4b419149 Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents: 630
diff changeset
138 editable: false
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 944
diff changeset
139 },
965
a2c2039bb5d9 Disabled StatusGrid Edit when StatusEdit ist false, Load StatuswerteStore differently, removed a bunch of trailing commas
Dustin Demuth <dustin@intevation.de>
parents: 964
diff changeset
140 sortable: false
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
141 }, {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
142 header: 'Text',
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 944
diff changeset
143 dataIndex: 'text',
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
144 flex: 1,
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
145 editor: {
663
1c5a4b419149 Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents: 630
diff changeset
146 allowBlank: true,
1c5a4b419149 Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents: 630
diff changeset
147 maxLength: 1000,
1c5a4b419149 Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents: 630
diff changeset
148 enforceMaxLength: true
945
023e622f9551 Added the ability to work with "StatusWerten" which are delivered by the lada-server.
Dustin Demuth <dustin@intevation.de>
parents: 944
diff changeset
149 },
965
a2c2039bb5d9 Disabled StatusGrid Edit when StatusEdit ist false, Load StatuswerteStore differently, removed a bunch of trailing commas
Dustin Demuth <dustin@intevation.de>
parents: 964
diff changeset
150 sortable: false
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
151 }];
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
152 this.initData();
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
153 this.callParent(arguments);
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: 799
diff changeset
154 this.setReadOnly(true); //Grid is always initialised as RO
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
155 },
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
156
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
157 initData: function() {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
158 if (this.store) {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
159 this.store.removeAll();
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
160 }
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
161 else {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
162 this.store = Ext.create('Lada.store.Status');
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
163 }
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
164 this.store.load({
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
165 params: {
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
166 messungsId: this.recordId
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
167 }
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
168 });
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: 683
diff changeset
169 },
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: 683
diff changeset
170
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: 683
diff changeset
171 setReadOnly: function(b) {
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: 683
diff changeset
172 if (b == true){
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: 683
diff changeset
173 //Readonly
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: 683
diff changeset
174 if (this.getPlugin('rowedit')){
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: 683
diff changeset
175 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: 683
diff changeset
176 }
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: 683
diff changeset
177 this.down('button[action=add]').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: 683
diff changeset
178 }else{
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: 683
diff changeset
179 //Writable
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: 683
diff changeset
180 if (this.getPlugin('rowedit')){
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: 683
diff changeset
181 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: 683
diff changeset
182 }
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: 799
diff changeset
183 //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: 683
diff changeset
184 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: 683
diff changeset
185 }
594
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
186 }
89b337cbfb5d Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
187 });

http://lada.wald.intevation.org