comparison src/implab/data/_ModelBase.js @ 34:27e8e9e38e07 default tip

Слияние
author nickolay
date Wed, 05 Jun 2019 20:44:15 +0300
parents 8af8e840dd49 1dc2fd263b90
children
comparison
equal deleted inserted replaced
33:8af8e840dd49 34:27e8e9e38e07
1 define(["dojo/_base/declare"], function(declare) {
2
3 return declare(null, {
4 dataContext : null,
5 idField : "id",
6 loaded : false,
7
8 constructor : function(opts){
9 if (opts) {
10 if(opts.dataContext)
11 this.dataContext = opts.dataContext;
12 if(opts.id)
13 this[this.idField] = opts.id;
14 }
15 },
16
17 getId : function() {
18 return this[this.idField];
19 },
20
21 attach : function(id, dc) {
22 if (this.dataContext)
23 throw new Error("The object is already attached");
24 this[this.idField] = id;
25 this.dataContext = dc;
26 },
27
28 isAttached : function() {
29 return this.dataContext ? true : false;
30 },
31
32 onPopulate : function() {
33 this.loaded = true;
34 }
35
36 });
37 });