Mercurial > lada > lada-client
changeset 136:4dc84682110d
Removed nested elements in Zusatzwerte. Change getting aditional info for
Probenzusätze in the Zusatzwert listing.
author | Torsten Irländer <torsten.irlaender@intevation.de> |
---|---|
date | Wed, 26 Jun 2013 10:18:08 +0200 |
parents | e80a9114524c |
children | a7eea094d3d6 |
files | app/model/Zusatzwert.js app/view/zusatzwerte/List.js |
diffstat | 2 files changed, 12 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/app/model/Zusatzwert.js Wed Jun 26 10:16:10 2013 +0200 +++ b/app/model/Zusatzwert.js Wed Jun 26 10:18:08 2013 +0200 @@ -1,37 +1,13 @@ Ext.define('Lada.model.Zusatzwert', { extend: 'Ext.data.Model', - requires: [ - 'Lada.model.Probenzusatzwert' - ], fields: [ {name: "id"}, - // Commented out as pzsId must not be submitted to the server. On - // serverside the pzsId is taken from the nested sprobenZusatz object. - //{name: "pzsId", mapping: "id.pzsId"}, + {name: "pzsId", mapping: "id.pzsId"}, {name: "probeId", mapping: "id.probeId"}, {name: "nwgZuMesswert", type: 'float'}, {name: "messwertPzs", type: 'float'}, {name: "messfehler", type: 'float'}, - {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}, - - // Field for the nested Probenzusatzobject. This one is needed to have - // access to the nested data in the grid. - // TODO: I would have expected that this field does not need to be - // defined explicitly as there is the hasOne asscociation defined - // which name and associationKey named "sprobenZusatz". Anyway it does - // not seem to make problems. - {name: "sprobenZusatz"} - ], - hasOne: [ - { - model: 'Lada.model.Probenzusatzwert', - primaryKey: 'pzsId', - name: 'sprobenZusatz', - associationKey: 'sprobenZusatz', - foreignKey: 'pzsId', - getterName: 'getProbenzusatz', - setterName: 'setProbenzusatz' - } + {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()} ], idProperty: "id", proxy: { @@ -48,8 +24,7 @@ } }, getEidi: function () { - var sprobenZusatz = this.get('sprobenZusatz'); - var pzsId = sprobenZusatz.pzsId; + var pzsId = this.get('pzsId'); var probeId = this.get('probeId'); return "/" + pzsId + "/" + probeId; }
--- a/app/view/zusatzwerte/List.js Wed Jun 26 10:16:10 2013 +0200 +++ b/app/view/zusatzwerte/List.js Wed Jun 26 10:18:08 2013 +0200 @@ -34,16 +34,15 @@ this.columns = [ { header: 'PZW-ID', - dataIndex: 'sprobenZusatz', - renderer: function(value) { - return value.pzsId; - } + dataIndex: 'pzsId' }, { header: 'PZW-Größe', - dataIndex: 'sprobenZusatz', + dataIndex: 'pzsId', renderer: function(value) { - return value.beschreibung; + var store = Ext.getStore('Probenzusatzwerte'); + var record = store.getById(value); + return record.get('beschreibung'); }, flex: 1 }, @@ -51,9 +50,11 @@ {header: 'rel. Unsich.[%]', dataIndex: 'messfehler'}, { header: 'Maßeinheit', - dataIndex: 'sprobenZusatz', + dataIndex: 'pzsId', renderer: function(value) { - return value.mehId; + var store = Ext.getStore('Probenzusatzwerte'); + var record = store.getById(value); + return record.get('mehId'); } } ];