view app/model/Ort.js @ 134:1620d02d2973

Reset idProperty to probeId again as it seems the the submitted data will have an autogenerated id property "id" in the other case which causes problems on the server side.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Tue, 25 Jun 2013 17:33:56 +0200
parents 7ad96e3d70c1
children 26ac4c99f8c4
line wrap: on
line source
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: "gemId", mapping:"ort.gemId"},
        {name: "staatId", mapping:"ort.staatId"},
        {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);
}

http://lada.wald.intevation.org