Mercurial > lada > lada-client
comparison app/view/widgets/LadaForm.js @ 544:d2e90f117c20
updated error and warning handling.
author | Raimund Renkert <raimund.renkert@intevation.de> |
---|---|
date | Thu, 18 Dec 2014 15:04:21 +0100 |
parents | 66f3c5d258e2 |
children |
comparison
equal
deleted
inserted
replaced
543:ce188e2fab06 | 544:d2e90f117c20 |
---|---|
98 this.loadRecord(this.model); | 98 this.loadRecord(this.model); |
99 this.updateOnChange(); | 99 this.updateOnChange(); |
100 }, | 100 }, |
101 | 101 |
102 commit: function() { | 102 commit: function() { |
103 if (this.form.isDirty() && this.form.isValid()) { | 103 if (this.form.isDirty() && |
104 | 104 this.form.isValid()) { |
105 var data = this.model.getAllData(); | 105 var data = this.model.getAllData(); |
106 var baseUrl = this.model.getProxy().url; | 106 var baseUrl = this.model.getProxy().url; |
107 var url = baseUrl; | 107 var url = baseUrl; |
108 var method = 'POST'; | 108 var method = 'POST'; |
109 if (this.model.getId()) { | 109 if (this.model.getId()) { |
221 this.setReadOnly(this.model.get('readonly')); | 221 this.setReadOnly(this.model.get('readonly')); |
222 } | 222 } |
223 }, | 223 }, |
224 | 224 |
225 createMessages: function() { | 225 createMessages: function() { |
226 var messages = Ext.create('Ext.form.Panel', { | |
227 bodyPadding: '5 5 5 5' | |
228 }); | |
229 var key; | 226 var key; |
230 var label; | |
231 for (key in this.warnings) { | 227 for (key in this.warnings) { |
232 label = Ext.create('Ext.container.Container', { | 228 var element = this.down('component[name=' + key + ']'); |
233 layout: 'hbox', | 229 element.showWarnings(this.warnings[key]); |
234 bodyPadding: '5 5 5 5', | |
235 items: [{ | |
236 xtype: 'image', | |
237 src: 'gfx/icon-warning.gif', | |
238 width: 18, | |
239 height: 18 | |
240 }, { | |
241 xtype: 'label', | |
242 text: key + ': ' + this.warnings[key], | |
243 margin: '4 0 0 5' | |
244 }] | |
245 }); | |
246 messages.insert(0, label); | |
247 } | 230 } |
248 for (key in this.errors) { | 231 for (key in this.errors) { |
249 label = Ext.create('Ext.container.Container', { | 232 var element = this.down('component[name=' + key + ']'); |
250 layout: 'hbox', | 233 element.showErrors(this.errors[key]); |
251 bodyPadding: '5 5 5 5', | 234 } |
252 items: [{ | |
253 xtype: 'image', | |
254 src: 'gfx/icon-error.gif', | |
255 width: 18, | |
256 height: 18 | |
257 }, { | |
258 xtype: 'label', | |
259 text: key + ': ' + this.errors[key], | |
260 margin: '4 0 0 5' | |
261 }] | |
262 }); | |
263 messages.insert(0, label); | |
264 } | |
265 this.insert(0, messages); | |
266 }, | 235 }, |
267 | 236 |
268 updateOnChange: function() { | 237 updateOnChange: function() { |
269 console.log(this.isDirty()); | 238 console.log(this.isDirty()); |
270 var childs = this.query('toolbar'); | 239 var childs = this.query('toolbar'); |