comparison app/model/Base.js @ 310:aeeb0f534411

Added Base model class
author Torsten Irländer <torsten.irlaender@intevation.de>
date Fri, 09 Aug 2013 15:37:48 +0200
parents
children 7f5f74e62658
comparison
equal deleted inserted replaced
309:51897f9a6bbb 310:aeeb0f534411
1 /**
2 * Base class for models
3 */
4 Ext.define('Lada.model.Base', {
5 extend: 'Ext.data.Model',
6 requires: ['Lada.lib.Helpers'],
7 /**
8 * Define fields in the model
9 */
10 fields: [],
11 /**
12 * Define the property which is used as unique attribute in the model.
13 * This might cause problems whith combined PK in the database. See
14 * https://roundup-intern.intevation.de/bfs/issue30
15 */
16 idProperty: null,
17 /**
18 * Define the URL of the (REST) ressource where to query for this model
19 */
20 proxyUrl: null,
21 /**
22 * The Proxy used for this model. Defaults to a REST proxy which returns
23 * JSON. The payload is expected to be in a "data" node. The url of the
24 * proxy is configured in the proxyUrl attribute.
25 */
26 proxy: {
27 type: 'rest',
28 appendId: true, //default
29 url: this.proxyUrl,
30 reader: {
31 type: 'json',
32 root: 'data'
33 }
34 },
35 /**
36 * Helper function to build an ID which is used in the proxy calls. This
37 * function is a workaround for
38 * https://roundup-intern.intevation.de/bfs/issue30
39 * as some items can not be identified with a singe id.
40 */
41 getEidi: function() {
42 var kid = this.get('kId');
43 var probeId = this.get('probeId');
44 return "/" + kid + "/" + probeId;
45 }
46 });

http://lada.wald.intevation.org