diff options
author | François Frisch | 2012-03-16 17:57:18 -0700 |
---|---|---|
committer | François Frisch | 2012-03-17 10:59:11 -0700 |
commit | 9b8a24a7360416d5750828c9580e33dd336ff882 (patch) | |
tree | 15fd53cc9e2c65309997ac8a888270f34e89f2a1 /node_modules | |
parent | 954f5a13e371febcb1c0fb8015c577ee51c23130 (diff) | |
download | ninja-9b8a24a7360416d5750828c9580e33dd336ff882.tar.gz |
Getting ownerComponent bindings
Diffstat (limited to 'node_modules')
-rw-r--r-- | node_modules/components-data/textfield.json | 4 | ||||
-rw-r--r-- | node_modules/montage/ui/text-input.js | 22 |
2 files changed, 26 insertions, 0 deletions
diff --git a/node_modules/components-data/textfield.json b/node_modules/components-data/textfield.json index 7164b8b3..39c65eab 100644 --- a/node_modules/components-data/textfield.json +++ b/node_modules/components-data/textfield.json | |||
@@ -7,6 +7,10 @@ | |||
7 | 7 | ||
8 | "properties": [ | 8 | "properties": [ |
9 | { | 9 | { |
10 | "name": "valueBinding", | ||
11 | "type": "string", | ||
12 | "default": null | ||
13 | },{ | ||
10 | "name": "accept", | 14 | "name": "accept", |
11 | "type": "string", | 15 | "type": "string", |
12 | "default": null | 16 | "default": null |
diff --git a/node_modules/montage/ui/text-input.js b/node_modules/montage/ui/text-input.js index cdd20c78..d707fa69 100644 --- a/node_modules/montage/ui/text-input.js +++ b/node_modules/montage/ui/text-input.js | |||
@@ -79,6 +79,28 @@ var TextInput = exports.TextInput = Montage.create(NativeControl, { | |||
79 | } | 79 | } |
80 | }, | 80 | }, |
81 | 81 | ||
82 | _valueBinding: { | ||
83 | value: null | ||
84 | }, | ||
85 | |||
86 | valueBinding: { | ||
87 | get: function() { | ||
88 | return this._valueBinding; | ||
89 | }, | ||
90 | set: function(value) { | ||
91 | if (this._valueBinding !== value) { | ||
92 | if (this._valueBinding !== null) { | ||
93 | Object.deleteBinding(this, "value"); | ||
94 | } | ||
95 | this._valueBinding = value; | ||
96 | if (String.isString(value)) { | ||
97 | Object.defineBinding(this, "value", {boundObject: this.ownerComponent, boundObjectPropertyPath: value}); | ||
98 | |||
99 | } | ||
100 | } | ||
101 | } | ||
102 | }, | ||
103 | |||
82 | // set value from user input | 104 | // set value from user input |
83 | /** | 105 | /** |
84 | @private | 106 | @private |