comparison app/view/form/Probe.js @ 771:dd6925ef6028

Load, set and parse deskriptoren in probe form.
author Raimund Renkert <raimund.renkert@intevation.de>
date Tue, 12 May 2015 15:12:02 +0200
parents 2e8da590ea0c
children afdbe3770b99
comparison
equal deleted inserted replaced
770:3185a77e8501 771:dd6925ef6028
18 'Lada.view.widget.Netzbetreiber', 18 'Lada.view.widget.Netzbetreiber',
19 'Lada.view.widget.Betriebsart', 19 'Lada.view.widget.Betriebsart',
20 'Lada.view.widget.Testdatensatz', 20 'Lada.view.widget.Testdatensatz',
21 'Lada.view.widget.Probenart', 21 'Lada.view.widget.Probenart',
22 'Lada.view.widget.Umwelt', 22 'Lada.view.widget.Umwelt',
23 'Lada.view.widget.Deskriptor',
23 'Lada.view.widget.base.TextField', 24 'Lada.view.widget.base.TextField',
24 'Lada.view.widget.base.Datetime', 25 'Lada.view.widget.base.Datetime',
25 'Lada.view.widget.base.FieldSet', 26 'Lada.view.widget.base.FieldSet',
26 'Lada.view.widget.base.DateField', 27 'Lada.view.widget.base.DateField',
27 'Lada.model.Probe', 28 'Lada.model.Probe'
28 ], 29 ],
29 30
30 model: 'Lada.model.Probe', 31 model: 'Lada.model.Probe',
31 minWidth: 650, 32 minWidth: 650,
32 margin: 5, 33 margin: 5,
301 setRecord: function(record) { 302 setRecord: function(record) {
302 this.clearMessages(); 303 this.clearMessages();
303 this.getForm().loadRecord(record); 304 this.getForm().loadRecord(record);
304 }, 305 },
305 306
307 setMediaDesk: function(record) {
308 var media = record.get('mediaDesk').split(' ');
309 this.setMediaSN(0, media);
310 },
311
312 setMediaSN: function(ndx, media) {
313 if (ndx >= 12) {
314 return;
315 }
316 var me = this;
317 var current = this.down('deskriptor[layer=' + ndx + ']');
318 var cbox = current.down('combobox');
319 if (ndx === 0) {
320 cbox.store.proxy.extraParams = {
321 'layer': ndx
322 };
323 }
324 else {
325 var parents = current.getParents(current.down('combobox'));
326 if (parents.length === 0) {
327 return;
328 }
329 cbox.store.proxy.extraParams = {
330 'layer': ndx,
331 'parents': parents
332 };
333 }
334 cbox.store.load(function(records, op, success) {
335 if (!success) {
336 return;
337 }
338 cbox.select(cbox.store.findRecord('sn', parseInt(media[ndx + 1], 10)));
339 me.setMediaSN(++ndx, media);
340 });
341 },
342
306 setMessages: function(errors, warnings) { 343 setMessages: function(errors, warnings) {
307 var key; 344 var key;
308 var element; 345 var element;
309 var content; 346 var content;
310 var i18n = Lada.getApplication().bundle; 347 var i18n = Lada.getApplication().bundle;
384 421
385 buildDescriptors: function() { 422 buildDescriptors: function() {
386 var fields = []; 423 var fields = [];
387 for (var i = 0; i < 12; i++) { 424 for (var i = 0; i < 12; i++) {
388 fields[i] = { 425 fields[i] = {
426 xtype: 'deskriptor',
389 fieldLabel: 'S' + i, 427 fieldLabel: 'S' + i,
390 name: 's' + i, 428 name: 's' + i,
391 labelWidth: 25, 429 labelWidth: 25,
430 width: 190,
431 layer: i,
392 margin: '0, 10, 5, 0' 432 margin: '0, 10, 5, 0'
393 }; 433 };
394 } 434 }
395 return fields; 435 return fields;
396 } 436 }

http://lada.wald.intevation.org