comparison app/view/form/Messung.js @ 957:881984972e0e

Added Statusstufe to MessungForm
author Dustin Demuth <dustin@intevation.de>
date Mon, 09 Nov 2015 14:13:27 +0100
parents b401846e7817
children 5d57c6c53e20
comparison
equal deleted inserted replaced
956:45c67a784b31 957:881984972e0e
127 isFormField: false, 127 isFormField: false,
128 preventMark: true, //Do not display error msg. 128 preventMark: true, //Do not display error msg.
129 validateValue: function() { 129 validateValue: function() {
130 return true; //this field is always valid 130 return true; //this field is always valid
131 }, 131 },
132 }, {
133 xtype: 'textfield',
134 name: 'stufe',
135 readOnly: true,
136 isFormField: false,
137 maxLength: 10,
138 margin: '0, 10, 5, 0',
139 fieldLabel: 'Stufe',
140 width: 300,
141 labelWidth: 100,
142 submitValue: false,
143 isFormField: false,
144 preventMark: true, //Do not display error msg.
145 validateValue: function() {
146 return true; //this field is always valid
147 },
132 }] 148 }]
133 }] 149 }]
134 }]; 150 }];
135 this.callParent(arguments); 151 this.callParent(arguments);
136 }, 152 },
151 if (!sStore) { 167 if (!sStore) {
152 sStore = Ext.create('Lada.store.Status'); 168 sStore = Ext.create('Lada.store.Status');
153 } 169 }
154 sStore.on('load', 170 sStore.on('load',
155 function(records, operation, success) { 171 function(records, operation, success) {
156 var ret; 172 var sw, ss;
157 var i18n = Lada.getApplication().bundle; 173 var i18n = Lada.getApplication().bundle;
158 if (sStore.getTotalCount() === 0 || !statusId) { 174 if (sStore.getTotalCount() === 0 || !statusId) {
159 ret = 0; 175 sw = 0;
160 } 176 }
161 else { 177 else {
162 ret = sStore.getById(statusId).get('statusWert'); 178 sw = sStore.getById(statusId).get('statusWert');
163 } 179 ss = sStore.getById(statusId).get('statusStufe');
164 this.setStatusWert(ret); 180 }
181 this.setStatusWert(sw);
182 this.setStatusStufe(ss);
165 }, 183 },
166 this); 184 this);
167 sStore.load({ 185 sStore.load({
168 params: { 186 params: {
169 messungsId: messungsId 187 messungsId: messungsId
170 } 188 }
171 }); 189 });
172 }, 190 },
173 191
192 /**
193 * Updates the Messungform and fills the Statuswert
194 */
174 setStatusWert: function(value){ 195 setStatusWert: function(value){
175 var swStore = Ext.StoreManager.lookup('StatusWerte'); 196 var swStore = Ext.StoreManager.lookup('StatusWerte');
176 if (!swStore) { 197 if (!swStore) {
177 var swStore = Ext.create('Lada.store.StatusWerte'); 198 var swStore = Ext.create('Lada.store.StatusWerte');
178 } 199 }
181 callback: function(records, operation, success) { 202 callback: function(records, operation, success) {
182 var i18n = Lada.getApplication().bundle; 203 var i18n = Lada.getApplication().bundle;
183 var msg = i18n.getMsg('load.statuswert.error'); 204 var msg = i18n.getMsg('load.statuswert.error');
184 var textfield = this.down('[name=status]'); 205 var textfield = this.down('[name=status]');
185 if (success) { 206 if (success) {
186 msg = swStore.getById(value).get('wert'); 207 var item = swStore.getById(value);
208 if (item) {
209 msg = item.get('wert');
210 }
211 }
212 textfield.setRawValue(msg);
213 },
214 });
215 },
216
217 /**
218 * Updates the Messungform and fills the StatusStufe
219 */
220 setStatusStufe: function(value){
221 var ssStore = Ext.StoreManager.lookup('StatusStufe');
222 if (!ssStore) {
223 var ssStore = Ext.create('Lada.store.StatusStufe');
224 }
225 ssStore.load({
226 scope: this,
227 callback: function(records, operation, success) {
228 var i18n = Lada.getApplication().bundle;
229 var msg = i18n.getMsg('load.statusstufe.error');
230 var textfield = this.down('[name=stufe]');
231 if (success) {
232 var item = ssStore.getById(value);
233 if (item) {
234 msg = item.get('stufe');
235 }
187 } 236 }
188 textfield.setRawValue(msg); 237 textfield.setRawValue(msg);
189 }, 238 },
190 }); 239 });
191 }, 240 },

http://lada.wald.intevation.org