Mercurial > lada > lada-client
annotate app/view/widgets/LadaForm.js @ 240:910cd477bfda
Added a comment with a list of currently available columns.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Tue, 23 Jul 2013 11:30:57 +0200 |
parents | 08144d625b2b |
children | 82118c01bc52 |
rev | line source |
---|---|
66
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
1 Ext.define('Lada.view.widgets.LadaForm', { |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
2 extend: 'Ext.form.Panel', |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
3 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
4 alias: 'widget.ladaform', |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
5 /** |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
6 * http://moduscreate.com/expert-ext-js-model-integration-in-forms/ |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
7 */ |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
8 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
9 /** |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
10 * Can be a reference to a model instance or a model class name. |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
11 */ |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
12 model: null, |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
13 /** |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
14 * Set to the id of the model instance and the model will be loaded for you. |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
15 * Only applicable if model provided is a model class name (string). |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
16 */ |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
17 modelId: null, |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
18 bodyPadding: '10 10', |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
19 border: 0, |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
20 |
75
4a82e28dfcc4
Translate error codes and store them as attributes of the form
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
74
diff
changeset
|
21 errors: null, |
4a82e28dfcc4
Translate error codes and store them as attributes of the form
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
74
diff
changeset
|
22 warnings: null, |
4a82e28dfcc4
Translate error codes and store them as attributes of the form
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
74
diff
changeset
|
23 message: null, |
133
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
24 success: null, |
87
ee1d1305dcff
Added field for netzbetreiber. Is needed because of FK constraints.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
85
diff
changeset
|
25 readonly: false, |
75
4a82e28dfcc4
Translate error codes and store them as attributes of the form
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
74
diff
changeset
|
26 |
66
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
27 initComponent: function() { |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
28 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
29 this.callParent(); |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
30 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
31 this.getForm().trackResetOnLoad = true; //Workaround |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
32 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
33 if (Ext.isString(this.model)) { |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
34 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
35 //Load a model to be updated |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
36 if (this.modelId) { |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
37 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
38 Ext.ClassManager.get(this.model).load(this.modelId, { |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
39 failure: this.onModelLoadFailure, |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
40 success: this.onModelLoadSuccess, |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
41 scope: this |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
42 }); |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
43 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
44 //Load an empty record to be inserted |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
45 } else { |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
46 this.bindModel(Ext.create(this.model, {})); |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
47 } |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
48 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
49 } else { |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
50 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
51 //Bind the provided model to be updated |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
52 this.bindModel(this.model); |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
53 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
54 } |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
55 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
56 this.addEvents('loadsuccess', 'loadfailure', 'savesuccess', 'savefailure'); |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
57 }, |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
58 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
59 bindModel: function(model) { |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
60 this.model = model; |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
61 this.loadRecord(model); |
189
214d1b274a50
As the model now should have a readonly flag, the check if the form must be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
188
diff
changeset
|
62 // Set the form to readonly if the models readonly attribute is |
211
401d559e0461
Fix rendering the form readonly.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
189
diff
changeset
|
63 // true |
401d559e0461
Fix rendering the form readonly.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
189
diff
changeset
|
64 if (model.get('readonly') === true) { |
189
214d1b274a50
As the model now should have a readonly flag, the check if the form must be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
188
diff
changeset
|
65 this.setReadOnly(true); |
214d1b274a50
As the model now should have a readonly flag, the check if the form must be
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
188
diff
changeset
|
66 } |
66
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
67 }, |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
68 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
69 commit: function(callback, scope) { |
84
5ad82cff1a21
Only submit form if internal validation is ok.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
83
diff
changeset
|
70 if (this.form.isDirty() && this.form.isValid()) { |
66
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
71 this.form.updateRecord(this.model); |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
72 |
133
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
73 var data = this.model.getAllData(); |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
74 var baseUrl = this.model.getProxy().url; |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
75 var url = baseUrl; |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
76 var method = "POST"; |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
77 if (this.model.getId()) { |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
78 url += this.model.getEidi(); |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
79 method = "PUT"; |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
80 } |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
81 |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
82 Ext.Ajax.request({ |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
83 url: url, |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
84 jsonData: data, |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
85 method: method, |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
86 callback: function(option, success, response) { |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
87 this.parseResponse(response); |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
88 if (this.success) { |
66
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
89 console.log('Save was successfull'); |
133
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
90 this.fireEvent('savesuccess', this); |
66
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
91 } else { |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
92 console.log('Save was not successfull'); |
75
4a82e28dfcc4
Translate error codes and store them as attributes of the form
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
74
diff
changeset
|
93 this.form.markInvalid(this.errors); |
133
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
94 this.fireEvent('savefailure', this); |
66
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
95 } |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
96 }, |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
97 scope: this |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
98 }); |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
99 } |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
100 }, |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
101 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
102 onModelLoadSuccess: function(record, operation) { |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
103 this.bindModel(record); |
83
8525e3525538
Move parsing the response in a seperate function.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
75
diff
changeset
|
104 this.parseResponse(operation); |
66
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
105 this.fireEvent('loadsuccess', this, record, operation); |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
106 }, |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
107 |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
108 onModelLoadFailure: function(record, operation) { |
83
8525e3525538
Move parsing the response in a seperate function.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
75
diff
changeset
|
109 this.parseResponse(operation); |
66
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
110 this.fireEvent('loadfailure', this, record, operation); |
74
5c58c0e8936b
Add function which translates the errorcodes returned from the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
66
diff
changeset
|
111 }, |
5c58c0e8936b
Add function which translates the errorcodes returned from the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
66
diff
changeset
|
112 |
5c58c0e8936b
Add function which translates the errorcodes returned from the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
66
diff
changeset
|
113 translateReturnCodes: function(codes) { |
5c58c0e8936b
Add function which translates the errorcodes returned from the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
66
diff
changeset
|
114 var translated = {}; |
5c58c0e8936b
Add function which translates the errorcodes returned from the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
66
diff
changeset
|
115 for (var k in codes) { |
5c58c0e8936b
Add function which translates the errorcodes returned from the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
66
diff
changeset
|
116 translated[k] = Lada.getApplication().bundle.getMsg(codes[k]); |
5c58c0e8936b
Add function which translates the errorcodes returned from the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
66
diff
changeset
|
117 } |
5c58c0e8936b
Add function which translates the errorcodes returned from the server.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
66
diff
changeset
|
118 return translated; |
83
8525e3525538
Move parsing the response in a seperate function.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
75
diff
changeset
|
119 }, |
85
079f99229eff
Added function to mark the form as readonly.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
84
diff
changeset
|
120 setReadOnly: function (bReadOnly) { |
221
cf83b382dc02
setReadOnly now also iterates over the toolbars within the form and hide them
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
211
diff
changeset
|
121 /* Iterate over all fields and set them readonly */ |
228
08144d625b2b
Only iterate over fields of the form is readonly. This increases the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
221
diff
changeset
|
122 if (bReadOnly) { |
08144d625b2b
Only iterate over fields of the form is readonly. This increases the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
221
diff
changeset
|
123 this.getForm().getFields().each (function (field) { |
08144d625b2b
Only iterate over fields of the form is readonly. This increases the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
221
diff
changeset
|
124 //field.setDisabled(bReadOnly); |
08144d625b2b
Only iterate over fields of the form is readonly. This increases the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
221
diff
changeset
|
125 field.setReadOnly(true); |
08144d625b2b
Only iterate over fields of the form is readonly. This increases the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
221
diff
changeset
|
126 }); |
08144d625b2b
Only iterate over fields of the form is readonly. This increases the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
221
diff
changeset
|
127 /* Iterate over all toolbars of lists and hide them */ |
08144d625b2b
Only iterate over fields of the form is readonly. This increases the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
221
diff
changeset
|
128 var childs = this.query('toolbar'); |
08144d625b2b
Only iterate over fields of the form is readonly. This increases the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
221
diff
changeset
|
129 for (var i = childs.length - 1; i >= 0; i--){ |
08144d625b2b
Only iterate over fields of the form is readonly. This increases the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
221
diff
changeset
|
130 childs[i].setVisible(false); |
08144d625b2b
Only iterate over fields of the form is readonly. This increases the
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
221
diff
changeset
|
131 } |
221
cf83b382dc02
setReadOnly now also iterates over the toolbars within the form and hide them
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
211
diff
changeset
|
132 } |
85
079f99229eff
Added function to mark the form as readonly.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
84
diff
changeset
|
133 }, |
133
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
134 parseResponse: function(response) { |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
135 var json = Ext.decode(response.responseText); |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
136 if (json) { |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
137 this.success = json.success; |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
138 this.errors = this.translateReturnCodes(json.errors); |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
139 this.warnings = this.translateReturnCodes(json.warnings); |
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
140 this.message = Lada.getApplication().bundle.getMsg(json.message); |
185
df5dcdff7b69
Enabled readonly mode
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
133
diff
changeset
|
141 } else { |
211
401d559e0461
Fix rendering the form readonly.
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
189
diff
changeset
|
142 this.setReadOnly(this.model.get('readonly')); |
133
819bfedb70de
Do not use the model.save mathod to store items in the databut but trigger a
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
87
diff
changeset
|
143 } |
66
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
144 } |
fcb63271d1bd
Created custom Form element which is bound to the model
Torsten Irländer <torsten.irlaender@intevation.de>
parents:
diff
changeset
|
145 }); |