# HG changeset patch # User Torsten Irländer # Date 1371126258 -7200 # Node ID 21c069e2ecdb92e43a7506c7c6aaa27a6850889d # Parent ab067fdb91b5d736f6d7bc4de1575a6d2621d654 Added Orte to the Proben edit window diff -r ab067fdb91b5 -r 21c069e2ecdb app/controller/Proben.js --- a/app/controller/Proben.js Thu Jun 13 11:04:11 2013 +0200 +++ b/app/controller/Proben.js Thu Jun 13 14:24:18 2013 +0200 @@ -7,6 +7,7 @@ ], stores: [ 'Proben', + 'Orte', 'Uwb', 'Datenbasis', 'Probenart', diff -r ab067fdb91b5 -r 21c069e2ecdb app/model/Ort.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/model/Ort.js Thu Jun 13 14:24:18 2013 +0200 @@ -0,0 +1,35 @@ +Ext.define('Lada.model.Ort', { + extend: 'Ext.data.Model', + fields: [ + {name: "ort"}, + {name: "ortId", mapping:"ort.ortId", type: 'int'}, + {name: "otyp", mapping:"ort.otyp"}, + {name: "bezeichnung", mapping:"ort.bezeichnung"}, + {name: "beschreibung", mapping:"ort.beschreibung"}, + {name: "unscharf", mapping:"ort.unscharf"}, + {name: "nutsCode", mapping:"ort.nutsCode"}, + {name: "koordXExtern", mapping:"ort.koordXExtern"}, + {name: "koordYExtern", mapping:"ort.koordYExtern"}, + {name: "hoeheLand", mapping:"ort.hoeheLand", type: 'float'}, + {name: "letzteAenderung", mapping:"ort.letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}, + {name: "latitude", mapping:"ort.latitude", type: 'float'}, + {name: "longitude", mapping:"ort.longitude", type: 'float'} + ], + idProperty: "ortId", + proxy: { + type: 'rest', + appendId: true, //default + url: 'server/rest/ort', + api: { + }, + reader: { + type: 'json', + root: 'data' + } + } +}); + +function ts2date(v, record){ + // Converts a timestamp into a date object. + return new Date(v); +} diff -r ab067fdb91b5 -r 21c069e2ecdb app/store/Orte.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/store/Orte.js Thu Jun 13 14:24:18 2013 +0200 @@ -0,0 +1,4 @@ +Ext.define('Lada.store.Orte', { + extend: 'Ext.data.Store', + model: 'Lada.model.Ort' +}); diff -r ab067fdb91b5 -r 21c069e2ecdb app/view/orte/List.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/app/view/orte/List.js Thu Jun 13 14:24:18 2013 +0200 @@ -0,0 +1,43 @@ +Ext.define('Lada.view.orte.List' ,{ + extend: 'Ext.grid.Panel', + alias: 'widget.ortelist', + store: 'Orte', + viewConfig: { + maxHeight: 350, + emptyText: 'Keine Orte gefunden.', + // minHeight and deferEmptyText are needed to be able to show the + // emptyText message. + minHeight: 35, + deferEmptyText: false + }, + initComponent: function() { + this.dockedItems = [ + { + xtype: 'toolbar', + dock: 'top', + items: [ + { + text: 'Hinzufügen', + icon: 'gfx/plus.gif', + action: 'add' + }, + { + text: 'Löschen', + icon: 'gfx/minus.gif', + action: 'delete' + } + ] + } + ]; + this.columns = [ + {header: 'Typ', dataIndex: 'otyp'}, + {header: 'ID', dataIndex: 'ortId'}, + {header: 'Staat', dataIndex: ''}, + {header: 'Gem-ID', dataIndex: ''}, + {header: 'Gemeindebezeichnung', dataIndex: 'bezeichnung'}, + {header: 'Messpunkt', dataIndex: ''} + ]; + this.callParent(arguments); + } +}); + diff -r ab067fdb91b5 -r 21c069e2ecdb app/view/proben/Edit.js --- a/app/view/proben/Edit.js Thu Jun 13 11:04:11 2013 +0200 +++ b/app/view/proben/Edit.js Thu Jun 13 14:24:18 2013 +0200 @@ -19,7 +19,8 @@ 'Lada.view.widgets.Betriebsart', 'Lada.view.widgets.Testdatensatz', 'Lada.view.widgets.Netzbetreiber', - 'Lada.view.kommentare.List' + 'Lada.view.kommentare.List', + 'Lada.view.orte.List' ], initComponent: function() { @@ -37,6 +38,15 @@ //probe: record.data['probeId'] } }); + // Load Orte + var orte = form.down('ortelist'); + var ostore = orte.getStore(); + ostore.load({ + params: { + probe: this.initialConfig['modelId'] + //probe: record.data['probeId'] + } + }); this.items = [form]; this.buttons = [ { diff -r ab067fdb91b5 -r 21c069e2ecdb app/view/proben/EditForm.js --- a/app/view/proben/EditForm.js Thu Jun 13 11:04:11 2013 +0200 +++ b/app/view/proben/EditForm.js Thu Jun 13 14:24:18 2013 +0200 @@ -148,42 +148,7 @@ padding: '10 10', items: [ { - xtype: 'grid', - dockedItems: [ - { - xtype: 'toolbar', - dock: 'top', - items: [ - { - text: 'Hinzufügen', - icon: 'gfx/plus.gif' - }, - { - text: 'Löschen', - icon: 'gfx/minus.gif' - } - ] - } - ], - columns: [ - { - text: 'Typ' - }, - { - text: 'Staat' - }, - { - text: 'Gem-ID' - }, - { - text: 'Gemeindebezeichnung', - flex: 1 - }, - { - text: 'Messpunkt', - flex: 1 - } - ] + xtype: 'ortelist' } ] },