1 | define(["dojo/_base/declare", "dijit/_WidgetBase", "dojo/_base/lang"], function(declare, _WidgetBase, lang){ |
---|
2 | |
---|
3 | return declare("dojox.mvc.Group", _WidgetBase, { |
---|
4 | // summary: |
---|
5 | // A simple model-bound container widget with single-node binding to a data model. |
---|
6 | // |
---|
7 | // description: |
---|
8 | // A group is usually bound to an intermediate dojo/Stateful node in the data model. |
---|
9 | // Child dijits or custom view components inside a group inherit their parent |
---|
10 | // data binding context from it. |
---|
11 | |
---|
12 | // target: dojo/Stateful |
---|
13 | // The data model used for relative data binding. |
---|
14 | target: null, |
---|
15 | |
---|
16 | startup: function(){ |
---|
17 | // This code needed for ticket 14423 is using removeRepeatNode on a repeat to work with mobile.lists |
---|
18 | // this.select and this.onCheckStateChanged are called by ListItem so they need to be set |
---|
19 | // but it seems like a bit of a hack. |
---|
20 | var parent = null; |
---|
21 | if(lang.isFunction(this.getParent)){ |
---|
22 | if(this.getParent() && this.getParent().removeRepeatNode){ |
---|
23 | this.select = this.getParent().select; |
---|
24 | this.onCheckStateChanged = this.getParent().onCheckStateChanged; |
---|
25 | } |
---|
26 | } |
---|
27 | this.inherited(arguments); |
---|
28 | }, |
---|
29 | |
---|
30 | _setTargetAttr: function(/*dojo/Stateful*/ value){ |
---|
31 | // summary: |
---|
32 | // Handler for calls to set("target", val). |
---|
33 | // description: |
---|
34 | // Sets target and "ref" property so that child widgets can refer to. |
---|
35 | |
---|
36 | this._set("target", value); |
---|
37 | if(this.binding != value){ |
---|
38 | // The new value not matching to this.binding means that the change is not initiated by ref change. |
---|
39 | this.set("ref", value); |
---|
40 | } |
---|
41 | } |
---|
42 | }); |
---|
43 | }); |
---|