view app/model/Ort.js @ 275:52f66a913e1b

define lada specific datetimefield and set dateformat to german format.
author Torsten Irländer <torsten.irlaender@intevation.de>
date Wed, 07 Aug 2013 12:02:31 +0200
parents 4db982514a5f
children eb483558bce4
line wrap: on
line source
Ext.define('Lada.model.Ort', {
    extend: 'Ext.data.Model',
    fields: [
        // Field from the l_ort table
        {name: "portId", type: 'int'},
        {name: "ortId", type: 'int'},
        {name: "probeId"},
        {name: "ortsTyp"},
        {name: "ortszusatztext"},
        {name: "letzteAenderung", type: 'date', convert: ts2date, defaultValue: new Date()}
    ],
    idProperty: "portId",
    proxy: {
        type: 'rest',
        appendId: true, //default
        url: 'server/rest/ort',
        api: {
        },
        reader: {
            type: 'json',
            root: 'data'
        }
    },
    getEidi: function() {
        var ortId = this.get('portId');
        var probeId = this.get('probeId');
        return "/" + ortId + "/" + probeId;
    }
});

function ts2date(v, record){
    // Converts a timestamp into a date object.
    return new Date(v);
}

http://lada.wald.intevation.org