view app/model/Kommentar.js @ 100:8356595f4fdb

Changed store. Elements are in thate data attribute. Build custom id attribute.
author Torsten Irländer <torsten@irlaender.de>
date Mon, 17 Jun 2013 13:24:06 +0200
parents 2d6c4f4c9b11
children 84f32c62670f
line wrap: on
line source
Ext.define('Lada.model.Kommentar', {
    extend: 'Ext.data.Model',
    fields: [
        {name: "id"},
        {name: "kid", mapping:"id.kid"},
        {name: "convertedId", convert:buildId},
        {name: "probeId"},
        {name: "erzeuger"},
        {name: "kdatum"},
        {name: "ktext"}
    ],
    idProperty: "convertedId",
    proxy: {
        type: 'rest',
        appendId: true, //default
        url: 'server/rest/kommentare',
        reader: {
            type: 'json',
            root: 'data'
        }
    }
});

function buildId(v, record){
    return record.get('probeId') + record.get('kid');
}

http://lada.wald.intevation.org