comparison app/view/form/Messung.js @ 708:2ad36c8db968

Added ClearMessages, SetWarnigs, SetReadonly
author Dustin Demuth <dustin@intevation.de>
date Fri, 27 Mar 2015 15:54:43 +0100
parents a0df1a8dff24
children f204f30b824a
comparison
equal deleted inserted replaced
707:c632c7c34029 708:2ad36c8db968
63 action: 'discard', 63 action: 'discard',
64 disabled: true 64 disabled: true
65 }] 65 }]
66 }], 66 }],
67 items: [{ 67 items: [{
68 xtype: 'textfield', 68 xtype: 'tfield',
69 name: 'nebenprobenNr', 69 name: 'nebenprobenNr',
70 maxLength: 10, 70 maxLength: 10,
71 margin: '0, 10, 5, 0', 71 margin: '0, 10, 5, 0',
72 fieldLabel: 'Nebenprobennr.', 72 fieldLabel: 'Nebenprobennr.',
73 width: 300, 73 width: 300,
120 120
121 setRecord: function(record) { 121 setRecord: function(record) {
122 this.getForm().loadRecord(record); 122 this.getForm().loadRecord(record);
123 }, 123 },
124 124
125 setMessages: function() { 125 setMessages: function(errors, warnings) {
126 // TODO this is a stub 126 var key;
127 var element;
128 var content;
129 var i18n = Lada.getApplication().bundle;
130 if (warnings) {
131 for (key in warnings) {
132 element = this.down('component[name=' + key + ']');
133 if (!element) {
134 continue;
135 }
136 content = warnings[key];
137 var warnText = '';
138 for (var i = 0; i < content.length; i++) {
139 warnText += i18n.getMsg(content[i].toString()) + '\n';
140 }
141 element.showWarnings(warnText);
142 }
143 }
144 if (errors) {
145 for (key in errors) {
146 element = this.down('component[name=' + key + ']');
147 if (!element) {
148 continue;
149 }
150 content = errors[key];
151 var errorText = '';
152 for (var i = 0; i < content.length; i++) {
153 errorText += i18n.getMsg(content[i].toString()) + '\n';
154 }
155 element.showErrors(errorText);
156 }
157 }
127 }, 158 },
128 159
129 clearMessages: function() { 160 clearMessages: function() {
130 // TODO this is a stub 161 this.down('tfield[name=nebenprobenNr]').clearWarningOrError();
162 //this.down('messmethode[name=mmtId]').clearWarningOrError();
163 this.down('datetime[name=messzeitpunkt]').clearWarningOrError();
164 //this.down('numberfield[name=messdauer]').clearWarningOrError();
165 this.down('chkbox[name=fertig]').clearWarningOrError();
166 this.down('chkbox[name=geplant]').clearWarningOrError();
131 }, 167 },
132 168
133 setReadOnly: function(value) { 169 setReadOnly: function(value) {
134 this.down('textfield[name=nebenprobenNr]').setReadOnly(value); 170 this.down('tfield[name=nebenprobenNr]').setReadOnly(value);
135 this.down('messmethode[name=mmtId]').setReadOnly(value); 171 //this.down('messmethode[name=mmtId]').setReadOnly(value);
136 this.down('datetime[name=messzeitpunkt]').setReadOnly(value); 172 this.down('datetime[name=messzeitpunkt]').setReadOnly(value);
137 this.down('numberfield[name=messdauer]').setReadOnly(value); 173 this.down('numberfield[name=messdauer]').setReadOnly(value);
138 this.down('chkbox[name=fertig]').setReadOnly(value); 174 this.down('chkbox[name=fertig]').setReadOnly(value);
139 this.down('chkbox[name=geplant]').setReadOnly(value); 175 this.down('chkbox[name=geplant]').setReadOnly(value);
140 } 176 }

http://lada.wald.intevation.org