torsten@310: /** torsten@310: * Base class for models torsten@310: */ torsten@310: Ext.define('Lada.model.Base', { torsten@310: extend: 'Ext.data.Model', torsten@310: requires: ['Lada.lib.Helpers'], torsten@310: /** torsten@310: * Define fields in the model torsten@310: */ torsten@310: fields: [], torsten@310: /** torsten@310: * Define the property which is used as unique attribute in the model. torsten@310: * This might cause problems whith combined PK in the database. See torsten@310: * https://roundup-intern.intevation.de/bfs/issue30 torsten@310: */ torsten@310: idProperty: null, torsten@310: /** torsten@310: * Define the URL of the (REST) ressource where to query for this model torsten@310: */ torsten@310: proxyUrl: null, torsten@310: /** torsten@310: * The Proxy used for this model. Defaults to a REST proxy which returns torsten@310: * JSON. The payload is expected to be in a "data" node. The url of the torsten@310: * proxy is configured in the proxyUrl attribute. torsten@310: */ torsten@310: proxy: { torsten@310: type: 'rest', torsten@310: appendId: true, //default torsten@310: url: this.proxyUrl, torsten@310: reader: { torsten@310: type: 'json', torsten@310: root: 'data' torsten@310: } torsten@310: }, torsten@310: /** torsten@310: * Helper function to build an ID which is used in the proxy calls. This torsten@310: * function is a workaround for torsten@310: * https://roundup-intern.intevation.de/bfs/issue30 torsten@310: * as some items can not be identified with a singe id. torsten@310: */ torsten@310: getEidi: function() { torsten@310: var kid = this.get('kId'); torsten@310: var probeId = this.get('probeId'); torsten@310: return "/" + kid + "/" + probeId; torsten@310: } torsten@310: });