torsten@106: Ext.define('Lada.model.Zusatzwert', { torsten@106: extend: 'Ext.data.Model', torsten@106: fields: [ torsten@138: {name: "pzsId"}, torsten@138: {name: "probeId"}, torsten@114: {name: "nwgZuMesswert", type: 'float'}, torsten@114: {name: "messwertPzs", type: 'float'}, torsten@114: {name: "messfehler", type: 'float'}, torsten@136: {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()} torsten@122: ], torsten@137: idProperty: "pzsId", torsten@106: proxy: { torsten@106: type: 'rest', torsten@106: appendId: true, //default torsten@106: url: 'server/rest/zusatzwert', torsten@106: reader: { torsten@106: type: 'json', torsten@106: root: 'data' torsten@122: }, torsten@122: writer: { torsten@122: type: 'json', torsten@122: writeEverything : true torsten@106: } torsten@131: }, torsten@131: getEidi: function () { torsten@136: var pzsId = this.get('pzsId'); torsten@131: var probeId = this.get('probeId'); torsten@131: return "/" + pzsId + "/" + probeId; torsten@142: }, torsten@142: getMesseinheit: function(pzsId) { torsten@142: var zstore = Ext.getStore('Probenzusatzwerte'); torsten@142: var mstore = Ext.getStore('Messeinheit'); torsten@142: var mehId = zstore.getById(pzsId).get('mehId'); torsten@142: var record = mstore.findRecord('mehId', mehId); torsten@142: return record.get('einheit'); torsten@106: } torsten@106: }); torsten@106: torsten@106: function buildId(v, record){ torsten@114: return record.get('probeId') + ',' + record.get('pzsId'); torsten@106: } torsten@114: torsten@114: function ts2date(v, record){ torsten@114: // Converts a timestamp into a date object. torsten@114: return new Date(v); torsten@114: }