# HG changeset patch # User Torsten Irländer # Date 1371829276 -7200 # Node ID d78bb4ca608966a368f1a06503e28d48e3a6867c # Parent a7bfaeb1655dc48d9bf37355e2ac50b2102dd41d Enabled accessing nested data in the grid through a renderer. diff -r a7bfaeb1655d -r d78bb4ca6089 app/model/Zusatzwert.js --- a/app/model/Zusatzwert.js Fri Jun 21 16:56:17 2013 +0200 +++ b/app/model/Zusatzwert.js Fri Jun 21 17:41:16 2013 +0200 @@ -10,14 +10,15 @@ {name: "nwgZuMesswert", type: 'float'}, {name: "messwertPzs", type: 'float'}, {name: "messfehler", type: 'float'}, - {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()} + {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}, - //// This are fields from the s_zusatzwert_table. They are currently not - //// needed for displaying values in the grid. - //{name: "sprobenZusatz"}, - //{name: "sprobenZusatz_beschreibung", mapping: "sprobenZusatz.beschreibung"}, - //{name: "sprobenZusatz_pzsId", mapping: "sprobenZusatz.pzsId"}, - //{name: "sprobenZusatz_mehId", mapping: "sprobenZusatz.mehId"} + // 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: [ { diff -r a7bfaeb1655d -r d78bb4ca6089 app/view/zusatzwerte/List.js --- a/app/view/zusatzwerte/List.js Fri Jun 21 16:56:17 2013 +0200 +++ b/app/view/zusatzwerte/List.js Fri Jun 21 17:41:16 2013 +0200 @@ -30,11 +30,30 @@ } ]; this.columns = [ - {header: 'PZW-ID', dataIndex: 'sprobenZusatz_pzsId'}, - {header: 'PZW-Größe', dataIndex: 'sprobenZusatz_beschreibung', flex: 1}, + { + header: 'PZW-ID', + dataIndex: 'sprobenZusatz', + renderer: function(value) { + return value.pzsId; + } + }, + { + header: 'PZW-Größe', + dataIndex: 'sprobenZusatz', + renderer: function(value) { + return value.beschreibung; + }, + flex: 1 + }, {header: 'Messwert', dataIndex: 'messwertPzs'}, {header: 'rel. Unsich.[%]', dataIndex: 'messfehler'}, - {header: 'Maßeinheit', dataIndex: 'sprobenZusatz_mehId'} + { + header: 'Maßeinheit', + dataIndex: 'sprobenZusatz', + renderer: function(value) { + return value.mehId; + } + } ]; this.callParent(arguments); }