From 9b8a24a7360416d5750828c9580e33dd336ff882 Mon Sep 17 00:00:00 2001 From: François Frisch Date: Fri, 16 Mar 2012 17:57:18 -0700 Subject: Getting ownerComponent bindings --- node_modules/components-data/textfield.json | 4 ++++ node_modules/montage/ui/text-input.js | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) (limited to 'node_modules') 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 @@ "properties": [ { + "name": "valueBinding", + "type": "string", + "default": null + },{ "name": "accept", "type": "string", "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, { } }, + _valueBinding: { + value: null + }, + + valueBinding: { + get: function() { + return this._valueBinding; + }, + set: function(value) { + if (this._valueBinding !== value) { + if (this._valueBinding !== null) { + Object.deleteBinding(this, "value"); + } + this._valueBinding = value; + if (String.isString(value)) { + Object.defineBinding(this, "value", {boundObject: this.ownerComponent, boundObjectPropertyPath: value}); + + } + } + } + }, + // set value from user input /** @private -- cgit v1.2.3