Mercurial > lada > lada-client
diff app/view/orte/CreateForm.js @ 149:26ac4c99f8c4
Added Orte.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Mon, 01 Jul 2013 17:05:03 +0200 |
parents | 2308094f5a8c |
children | 16ba7e2465fd |
line wrap: on
line diff
--- a/app/view/orte/CreateForm.js Mon Jul 01 14:20:08 2013 +0200 +++ b/app/view/orte/CreateForm.js Mon Jul 01 17:05:03 2013 +0200 @@ -1,24 +1,99 @@ Ext.define('Lada.view.orte.CreateForm', { extend: 'Lada.view.widgets.LadaForm', model: 'Lada.model.Ort', + requires: [ + 'Lada.view.widgets.Ortdetail', + 'Lada.view.widgets.Staat', + 'Lada.view.widgets.Verwaltungseinheit' + ], initComponent: function() { this.items = [ - //{ - // xtype: 'textfield', - // name: 'erzeuger', - // fieldLabel: 'Erzeuger' - //}, - //{ - // xtype: 'datefield', - // name: 'kdatum', - // fieldLabel: 'Datum' - //}, - //{ - // xtype: 'textareafield', - // name: 'ktext', - // fieldLabel: 'Text' - //} + { + xtype: 'ortdetail', + name: 'ortId', + fieldLabel: 'Ort', + listeners: { + scope: this, + 'change': function (field, newv, oldv, opts) { + console.log(field, oldv, newv, opts); + var orte = Ext.getStore('Ortedetails'); + var ort = orte.getById(newv); + var fields = ['beschreibung', 'bezeichnung', 'hoeheLand', + 'latitude', 'longitude', 'staatId', 'gemId']; + var form = this.getForm(); + if ( ort != undefined ) { + console.log('Found ort'); + for (var i = fields.length - 1; i >= 0; i--){ + ffield = form.findField("ort_"+fields[i]); + ffield.setValue(ort.get(fields[i])); + ffield.setReadOnly(true); + } + } else { + this.setReadOnly(false); + } + } + } + }, + { + xtype: 'textfield', + name: 'ortsTyp', + maxLength: 1, + fieldLabel: 'Type' + }, + { + xtype: 'textareafield', + name: 'ortszusatztext', + maxLength: 100, + fieldLabel: 'Ortszusatz' + }, + { + xtype: 'fieldset', + title: 'Ortsangaben', + defaults: { + labelWidth: 150 + }, + items: [ + { + xtype: 'textfield', + name: 'ort_beschreibung', + fieldLabel: 'Beschreibung' + }, + { + xtype: 'textfield', + name: 'ort_bezeichnung', + fieldLabel: 'Bezeichnung' + }, + { + xtype: 'staat', + name: 'ort_staatId', + fieldLabel: 'Staat' + }, + { + xtype: 'verwaltungseinheiten', + name: 'ort_gemId', + fieldLabel: 'Gemeinde' + }, + { + xtype: 'textfield', + name: 'ort_latitude', + fieldLabel: 'Lat' + }, + { + xtype: 'textfield', + name: 'ort_longitude', + fieldLabel: 'Lon' + }, + { + xtype: 'textfield', + name: 'ort_hoeheLand', + fieldLabel: 'Höhe' + } + ] + } ]; this.callParent(); + }, + updateOrtInfo: function(field, oldv, newv, opts) { + console.log(field, oldv, newv, opts); } });