comparison app/controller/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 e89a31b2c17e
children ff4330d4aba1
comparison
equal deleted inserted replaced
770:3185a77e8501 771:dd6925ef6028
27 'probeform': { 27 'probeform': {
28 dirtychange: this.dirtyForm 28 dirtychange: this.dirtyForm
29 }, 29 },
30 'probeform [xtype="datetime"] field': { 30 'probeform [xtype="datetime"] field': {
31 blur: this.checkDate 31 blur: this.checkDate
32 },
33 'probeform panel[xtype="deskriptor] combobox': {
34 select: this.deskriptorSelect
32 } 35 }
33 }); 36 });
34 }, 37 },
35 38
36 /** 39 /**
171 174
172 // Clear Warnings or Errors if none Are Present 175 // Clear Warnings or Errors if none Are Present
173 if (w == 0 && e == 0) { 176 if (w == 0 && e == 0) {
174 field.up().clearWarningOrError(); 177 field.up().clearWarningOrError();
175 } 178 }
179 },
180
181 deskriptorSelect: function(field, records) {
182 var desk = field.up('deskriptor');
183 var media = field.up('probeform').down('textfield[name="mediaDesk"]');
184 var current = media.getValue().split(' ');
185 this.clearChildDesk(field.up('deskriptor'), current);
186 if (current.length < 13) {
187 for (var i = 0; i <= 12; i++) {
188 if (i === 0) {
189 current.push('D:');
190 }
191 else if (i === desk.layer + 1) {
192 var value;
193 if (records[0].get('sn') < 10) {
194 value = '0' + records[0].get('sn');
195 }
196 else {
197 value = records[0].get('sn');
198 }
199 current.push(value);
200 }
201 else {
202 current.push('00');
203 }
204 }
205 }
206 else {
207 var value;
208 if (records[0].get('sn') < 10) {
209 value = '0' + records[0].get('sn');
210 }
211 else {
212 value = records[0].get('sn');
213 }
214 current[desk.layer + 1] = value;
215 }
216 media.setValue(current.join(' ').trim());
217 },
218
219 clearChildDesk: function(field, media) {
220 var allS = field.up('fieldset').items.items;
221 for (var i = field.layer + 1; i < 12; i++) {
222 allS[i].clearValue();
223 media[i + 1] = '00';
224 }
176 } 225 }
226
177 }); 227 });

http://lada.wald.intevation.org