Mercurial > lada > lada-client
comparison app/view/form/Messung.js @ 945:023e622f9551
Added the ability to work with "StatusWerten" which are delivered by the lada-server.
To enable the uses of StatusWerte, the controller for the status grid, needed to be extended.
In addition, the form and grid views of Messung and Status were updated.
author | Dustin Demuth <dustin@intevation.de> |
---|---|
date | Tue, 27 Oct 2015 16:46:58 +0100 |
parents | a1d72228af00 |
children | c7bf0b459074 |
comparison
equal
deleted
inserted
replaced
944:1f1467713c3f | 945:023e622f9551 |
---|---|
111 readOnly: true, | 111 readOnly: true, |
112 margin: '0, 10, 5, 0', | 112 margin: '0, 10, 5, 0', |
113 fieldLabel: 'Geplant', | 113 fieldLabel: 'Geplant', |
114 width: 300, | 114 width: 300, |
115 labelWidth: 100 | 115 labelWidth: 100 |
116 }, { | |
117 xtype: 'textfield', | |
118 name: 'status', | |
119 readOnly: true, | |
120 isFormField: false, | |
121 maxLength: 10, | |
122 margin: '0, 10, 5, 0', | |
123 fieldLabel: 'Status', | |
124 width: 300, | |
125 labelWidth: 100, | |
126 submitValue: false, | |
127 isFormField: false, | |
128 preventMark: true, //Do not display error msg. | |
129 validateValue: function() { | |
130 return true; //this field is always valid | |
131 }, | |
116 }] | 132 }] |
117 }] | 133 }] |
118 }]; | 134 }]; |
119 this.callParent(arguments); | 135 this.callParent(arguments); |
120 }, | 136 }, |
121 | 137 |
122 setRecord: function(record) { | 138 setRecord: function(record) { |
123 this.getForm().loadRecord(record); | 139 this.getForm().loadRecord(record); |
140 this.retrieveStatus(record.id, record.get('status')); | |
141 }, | |
142 | |
143 retrieveStatus: function(messungsId, statusId) { | |
144 var i18n = Lada.getApplication().bundle; | |
145 var msg = i18n.getMsg('load.statuswert'); | |
146 var textfield = this.down('[name=status]'); | |
147 | |
148 textfield.setRawValue(msg); | |
149 | |
150 var sStore = Ext.StoreManager.lookup('Status'); | |
151 if (!sStore) { | |
152 sStore = Ext.create('Lada.store.Status'); | |
153 } | |
154 sStore.on('load', | |
155 function(records, operation, success) { | |
156 var ret; | |
157 var i18n = Lada.getApplication().bundle; | |
158 if (sStore.getTotalCount() === 0) { | |
159 ret = 0; | |
160 } | |
161 else { | |
162 ret = sStore.getById(statusId).get('statusWert'); | |
163 } | |
164 this.setStatusWert(ret); | |
165 }, | |
166 this); | |
167 sStore.load({ | |
168 params: { | |
169 messungsId: messungsId | |
170 } | |
171 }); | |
172 }, | |
173 | |
174 setStatusWert: function(value){ | |
175 var swStore = Ext.StoreManager.lookup('StatusWerte'); | |
176 if (!swStore) { | |
177 var swStore = Ext.create('Lada.store.StatusWerte'); | |
178 } | |
179 swStore.on('load', | |
180 function(records, operation, success) { | |
181 var i18n = Lada.getApplication().bundle; | |
182 var msg = i18n.getMsg('load.statuswert.error'); | |
183 var textfield = this.down('[name=status]'); | |
184 if (success) { | |
185 msg = swStore.getById(value).get('wert'); | |
186 } | |
187 textfield.setRawValue(msg); | |
188 }, | |
189 this); | |
190 swStore.load(); | |
124 }, | 191 }, |
125 | 192 |
126 setMessages: function(errors, warnings) { | 193 setMessages: function(errors, warnings) { |
127 var key; | 194 var key; |
128 var element; | 195 var element; |