Mercurial > lada > lada-client
annotate app/view/grid/Status.js @ 1010:94a6b5415d73
Fixed edit status in grids.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 21 Jan 2016 08:59:13 +0100 |
parents | e92931b8f6b0 |
children | d8e74bd89d6b |
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 minHeight: 110, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
18 viewConfig: { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
19 deferEmptyText: false |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
20 }, |
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 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
|
23 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
|
24 allowDeselect: true, |
1000
5beb2581a989
A fix which is supposed to reload the statuswerte store, when the Add button is used
Dustin Demuth <dustin@intevation.de>
parents:
998
diff
changeset
|
25 statusWerteStore: null, |
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() { |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
28 var i18n = Lada.getApplication().bundle; |
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
29 this.emptyText = i18n.getMsg('statusgrid.emptyText'); |
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
30 |
1000
5beb2581a989
A fix which is supposed to reload the statuswerte store, when the Add button is used
Dustin Demuth <dustin@intevation.de>
parents:
998
diff
changeset
|
31 this.statusWerteStore = Ext.create('Lada.store.StatusWerte'); |
1001
e92931b8f6b0
A fix which is supposed to reload the statuswerte store, when the Add button is used, part 2
Dustin Demuth <dustin@intevation.de>
parents:
1000
diff
changeset
|
32 this.statusWerteStore.load({ |
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
|
33 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
|
34 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
|
35 } |
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 }); |
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
|
37 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
|
38 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
|
39 |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
40 this.rowEditing = Ext.create('Ext.grid.plugin.RowEditing', { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
41 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
|
42 autoCancel: false, |
990
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
43 disabled: true, //has no effect... but why? |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
44 pluginId: 'rowedit', |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
45 listeners: { |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
46 beforeedit: function(editor, context, eOpts) { |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
47 if (context.record.get('id') || |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
48 ! context.grid.up('window').record.get('statusEdit')) { |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
49 //Check if edit is allowed, this is true, when the selected |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
50 // Record has an id (=is not new) |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
51 // or is not allowed to add records. |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
52 |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
53 return false; |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
54 } |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
55 |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
56 |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
57 } |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
58 } |
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
|
59 }); |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
60 this.plugins = [this.rowEditing]; |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
61 |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
62 this.dockedItems = [{ |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
63 xtype: 'toolbar', |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
64 dock: 'bottom', |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
65 items: ['->', { |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
66 text: i18n.getMsg('reset'), |
994
092e245b13a4
draft implementation of the status-reset function: Todo: move this into a 'confirmation dialog'
Dustin Demuth <dustin@intevation.de>
parents:
990
diff
changeset
|
67 icon: 'resources/img/edit-redo.png', |
092e245b13a4
draft implementation of the status-reset function: Todo: move this into a 'confirmation dialog'
Dustin Demuth <dustin@intevation.de>
parents:
990
diff
changeset
|
68 action: 'reset', |
092e245b13a4
draft implementation of the status-reset function: Todo: move this into a 'confirmation dialog'
Dustin Demuth <dustin@intevation.de>
parents:
990
diff
changeset
|
69 probeId: this.probeId, |
092e245b13a4
draft implementation of the status-reset function: Todo: move this into a 'confirmation dialog'
Dustin Demuth <dustin@intevation.de>
parents:
990
diff
changeset
|
70 parentId: this.parentId |
092e245b13a4
draft implementation of the status-reset function: Todo: move this into a 'confirmation dialog'
Dustin Demuth <dustin@intevation.de>
parents:
990
diff
changeset
|
71 }, { |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
72 text: i18n.getMsg('add'), |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
73 icon: 'resources/img/list-add.png', |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
74 action: 'add', |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
75 probeId: this.probeId, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
76 parentId: this.parentId |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
77 }] |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
78 }]; |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 this.columns = [{ |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
80 header: i18n.getMsg('statusgrid.header.datum'), |
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
|
81 dataIndex: 'datum', |
944 | 82 xtype: 'datecolumn', |
83 format: 'd.m.Y H:i', | |
84 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
|
85 sortable: false |
944 | 86 }, { |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
87 header: i18n.getMsg('statusgrid.header.erzeuger'), |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
88 dataIndex: 'erzeuger', |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 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
|
90 var r = ''; |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 if (!value || value === '') { |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
92 r = i18n.getMsg('error'); |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
93 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 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
|
95 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
|
96 if (item) { |
6f1cc3316e2d
Intermediate Result. When creating a Messung a Statuswert will be set.
Dustin Demuth <dustin@intevation.de>
parents:
958
diff
changeset
|
97 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
|
98 } |
6f1cc3316e2d
Intermediate Result. When creating a Messung a Statuswert will be set.
Dustin Demuth <dustin@intevation.de>
parents:
958
diff
changeset
|
99 return r; |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
100 }, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
101 editor: { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
102 xtype: 'combobox', |
967
50d7b6e17525
Filter the selectable Messtellen in the statusgrid
Dustin Demuth <dustin@intevation.de>
parents:
965
diff
changeset
|
103 store: Ext.data.StoreManager.get('messstellenFiltered'), |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
104 displayField: 'messStelle', |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
105 valueField: 'id', |
663
1c5a4b419149
Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents:
630
diff
changeset
|
106 allowBlank: false, |
1c5a4b419149
Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents:
630
diff
changeset
|
107 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
|
108 }, |
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
|
109 sortable: false |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 }, { |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
111 header: i18n.getMsg('statusgrid.header.statusStufe'), |
956
45c67a784b31
Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents:
950
diff
changeset
|
112 dataIndex: 'statusStufe', |
45c67a784b31
Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents:
950
diff
changeset
|
113 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
|
114 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
|
115 var r; |
957
881984972e0e
Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents:
956
diff
changeset
|
116 if (value===null || value === '') { |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
117 r = i18n.getMsg('error'); |
956
45c67a784b31
Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents:
950
diff
changeset
|
118 } |
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
|
119 var item = sta.getById(value); |
957
881984972e0e
Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents:
956
diff
changeset
|
120 if (item) { |
881984972e0e
Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents:
956
diff
changeset
|
121 r = item.get('stufe'); |
881984972e0e
Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents:
956
diff
changeset
|
122 } |
956
45c67a784b31
Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents:
950
diff
changeset
|
123 return r; |
45c67a784b31
Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents:
950
diff
changeset
|
124 }, |
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
|
125 sortable: false |
956
45c67a784b31
Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents:
950
diff
changeset
|
126 }, { |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
127 header: i18n.getMsg('statusgrid.header.statusWert'), |
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
|
128 dataIndex: 'statusWert', |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
129 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
|
130 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
|
131 //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
|
132 var r; |
950
c7bf0b459074
Fixed some issues when the status is null
Dustin Demuth <dustin@intevation.de>
parents:
945
diff
changeset
|
133 if (value===null || value === '') { |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
134 r = i18n.getMsg('error'); |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
135 } |
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
|
136 var item = sta.getById(value); |
957
881984972e0e
Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents:
956
diff
changeset
|
137 if (item) { |
881984972e0e
Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents:
956
diff
changeset
|
138 r = item.get('wert'); |
881984972e0e
Added Statusstufe to MessungForm
Dustin Demuth <dustin@intevation.de>
parents:
956
diff
changeset
|
139 } |
956
45c67a784b31
Added StatusStufe to the StatusGrid. Created Store and Model for StatusStufe
Dustin Demuth <dustin@intevation.de>
parents:
950
diff
changeset
|
140 return r; |
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 editor: { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
143 xtype: 'combobox', |
1001
e92931b8f6b0
A fix which is supposed to reload the statuswerte store, when the Add button is used, part 2
Dustin Demuth <dustin@intevation.de>
parents:
1000
diff
changeset
|
144 store: this.statusWerteStore, |
968
8fabf9a3fee7
Make a local query for the statusWerteStore
Dustin Demuth <dustin@intevation.de>
parents:
967
diff
changeset
|
145 queryMode: 'local', |
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
|
146 displayField: 'wert', |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
147 valueField: 'id', |
663
1c5a4b419149
Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents:
630
diff
changeset
|
148 allowBlank: false, |
1c5a4b419149
Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents:
630
diff
changeset
|
149 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
|
150 }, |
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
|
151 sortable: false |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 }, { |
998
4bbb3da88c14
Statusreset: added a confirmation dialog and i18n
Dustin Demuth <dustin@intevation.de>
parents:
996
diff
changeset
|
153 header: i18n.getMsg('statusgrid.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
|
154 dataIndex: 'text', |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
155 flex: 1, |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 editor: { |
663
1c5a4b419149
Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents:
630
diff
changeset
|
157 allowBlank: true, |
1c5a4b419149
Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents:
630
diff
changeset
|
158 maxLength: 1000, |
1c5a4b419149
Field Validity in Status Grid
Dustin Demuth <dustin@intevation.de>
parents:
630
diff
changeset
|
159 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
|
160 }, |
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
|
161 sortable: false |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 }]; |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 this.initData(); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 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
|
165 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
|
166 }, |
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 initData: function() { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 if (this.store) { |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
170 this.store.removeAll(); |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 else { |
990
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
173 this.store = Ext.create('Lada.store.Status',{ |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
174 sorters: [{ |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
175 property: 'datum', |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
176 direction: 'ASC' |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
177 }] |
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
178 }); |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
179 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
180 this.store.load({ |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
181 params: { |
990
c2a726887dd7
The last status can not be edited anymore. When a new status is added, the new record is preset with ALL previous variables, this includes the StatusStufe! The Date is corrected to the current date. Also the store is sorted by Datum now.
Dustin Demuth <dustin@intevation.de>
parents:
969
diff
changeset
|
182 messungsId: this.recordId, |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
183 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
184 }); |
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
|
185 }, |
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
|
186 |
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
|
187 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
|
188 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
|
189 //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
|
190 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
|
191 }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
|
192 //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
|
193 this.down('button[action=add]').enable(); |
996
bf7bb9583a40
Statusworkflow: More work on the reset Button
Dustin Demuth <dustin@intevation.de>
parents:
994
diff
changeset
|
194 } |
bf7bb9583a40
Statusworkflow: More work on the reset Button
Dustin Demuth <dustin@intevation.de>
parents:
994
diff
changeset
|
195 }, |
bf7bb9583a40
Statusworkflow: More work on the reset Button
Dustin Demuth <dustin@intevation.de>
parents:
994
diff
changeset
|
196 |
bf7bb9583a40
Statusworkflow: More work on the reset Button
Dustin Demuth <dustin@intevation.de>
parents:
994
diff
changeset
|
197 setResetable: function(b) { |
bf7bb9583a40
Statusworkflow: More work on the reset Button
Dustin Demuth <dustin@intevation.de>
parents:
994
diff
changeset
|
198 if (b == true){ |
994
092e245b13a4
draft implementation of the status-reset function: Todo: move this into a 'confirmation dialog'
Dustin Demuth <dustin@intevation.de>
parents:
990
diff
changeset
|
199 this.down('button[action=reset]').enable(); |
996
bf7bb9583a40
Statusworkflow: More work on the reset Button
Dustin Demuth <dustin@intevation.de>
parents:
994
diff
changeset
|
200 }else{ |
bf7bb9583a40
Statusworkflow: More work on the reset Button
Dustin Demuth <dustin@intevation.de>
parents:
994
diff
changeset
|
201 this.down('button[action=reset]').disable(); |
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
|
202 } |
594
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 } |
89b337cbfb5d
Added status grid and controller.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
204 }); |