comparison app/view/form/Messung.js @ 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.
author Dustin Demuth <dustin@intevation.de>
date Thu, 12 Nov 2015 12:13:31 +0100
parents 6f1cc3316e2d
children a2c2039bb5d9
comparison
equal deleted inserted replaced
962:9b6800458a9e 963:6a6f2c6fe8ee
199 199
200 /** 200 /**
201 * Updates the Messungform and fills the Statuswert 201 * Updates the Messungform and fills the Statuswert
202 */ 202 */
203 setStatusWert: function(value){ 203 setStatusWert: function(value){
204 var swStore = Ext.create('Lada.store.StatusWerte'); 204 var swStore = Ext.data.StoreManager.get('statuswerte');
205 swStore.load({ 205 var i18n = Lada.getApplication().bundle;
206 scope: this, 206 var msg = i18n.getMsg('load.statuswert.error');
207 callback: function(records, operation, success) { 207 var textfield = this.down('[name=status]');
208 var i18n = Lada.getApplication().bundle; 208
209 var msg = i18n.getMsg('load.statuswert.error'); 209 if (!swStore) {
210 var textfield = this.down('[name=status]'); 210 //Set the textfield asynchronously
211 if (success) { 211 swStore = Ext.create('Lada.store.StatusWerte');
212 var item = swStore.getById(value); 212 swStore.load({
213 if (item) { 213 scope: this,
214 msg = item.get('wert'); 214 callback: function(records, operation, success) {
215 if (success) {
216 var item = swStore.getById(value);
217 if (item) {
218 msg = item.get('wert');
219 }
215 } 220 }
216 } 221 if (textfield) {
217 if (textfield) { 222 textfield.setRawValue(msg);
218 textfield.setRawValue(msg); 223 }
219 } 224 },
220 }, 225 });
221 }); 226 }
227 else {
228 //Set the textfield
229 var item = swStore.getById(value);
230 if (item) {
231 msg = item.get('wert');
232 }
233 if (textfield) {
234 textfield.setRawValue(msg);
235 }
236 }
237
222 }, 238 },
223 239
224 /** 240 /**
225 * Updates the Messungform and fills the StatusStufe 241 * Updates the Messungform and fills the StatusStufe
226 */ 242 */
227 setStatusStufe: function(value){ 243 setStatusStufe: function(value){
228 var ssStore = Ext.create('Lada.store.StatusStufe'); 244 var ssStore = Ext.data.StoreManager.get('statusstufe')
229 ssStore.load({ 245 var i18n = Lada.getApplication().bundle;
230 scope: this, 246 var msg = i18n.getMsg('load.statusstufe.error');
231 callback: function(records, operation, success) { 247 var textfield = this.down('[name=stufe]');
232 var i18n = Lada.getApplication().bundle; 248 if (!ssStore) {
233 var msg = i18n.getMsg('load.statusstufe.error'); 249 //set the value asynchronously
234 var textfield = this.down('[name=stufe]'); 250 Ext.create('Lada.store.StatusStufe');
235 if (success) { 251 ssStore.load({
236 var item = ssStore.getById(value); 252 scope: this,
237 if (item) { 253 callback: function(records, operation, success) {
238 msg = item.get('stufe'); 254 if (success) {
255 var item = ssStore.getById(value);
256 if (item) {
257 msg = item.get('stufe');
258 }
239 } 259 }
240 } 260 if (textfield) {
241 if (textfield) { 261 textfield.setRawValue(msg);
242 textfield.setRawValue(msg); 262 }
243 } 263 },
244 }, 264 });
245 }); 265 }
266 else {
267 //Set the value.
268 var item = ssStore.getById(value);
269 if (item) {
270 msg = item.get('stufe');
271 }
272 if (textfield) {
273 textfield.setRawValue(msg);
274 }
275 }
246 }, 276 },
247 277
248 setMessages: function(errors, warnings) { 278 setMessages: function(errors, warnings) {
249 var key; 279 var key;
250 var element; 280 var element;

http://lada.wald.intevation.org