From 77ae7eac9c90ce4362a369bd4169607ee610c18d Mon Sep 17 00:00:00 2001 From: Valerio Virgillito Date: Fri, 22 Jun 2012 22:45:38 -0700 Subject: Fixing our textfield component to support binding. Fix for IKNINJA-1394 Signed-off-by: Valerio Virgillito --- js/components/textfield.reel/textfield.js | 23 +++------------------- .../properties.reel/sections/custom.reel/custom.js | 6 +++--- 2 files changed, 6 insertions(+), 23 deletions(-) (limited to 'js') diff --git a/js/components/textfield.reel/textfield.js b/js/components/textfield.reel/textfield.js index 5e22fcc7..e16dd786 100755 --- a/js/components/textfield.reel/textfield.js +++ b/js/components/textfield.reel/textfield.js @@ -27,6 +27,7 @@ exports.TextField = Montage.create(Component, { }, set: function(value) { this._value = value; + this._valueSyncedWithInputField = false; this.needsDraw = true; } }, @@ -41,7 +42,7 @@ exports.TextField = Montage.create(Component, { handleBlur: { value: function(event) { - this._value = this.element.value; + this.value = this.element.value; this._valueSyncedWithInputField = true; var e = document.createEvent("CustomEvent"); @@ -51,27 +52,10 @@ exports.TextField = Montage.create(Component, { this.dispatchEvent(e); } }, - /* - handleChange: - { - value:function(event) - { - this._value = this.element.value; - this._valueSyncedWithInputField = true; - - var e = document.createEvent("CustomEvent"); - e.initEvent("change", true, true); - e.type = "change"; - e.value = this._value; - this.dispatchEvent(e); - } - }, - */ draw: { value: function() { - if(!this._valueSyncedWithInputField) - { + if(!this._valueSyncedWithInputField) { this.element.value = this._value; this._valueSyncedWithInputField = true; } @@ -80,7 +64,6 @@ exports.TextField = Montage.create(Component, { prepareForDraw: { value: function() { - //this.element.addEventListener("change", this, false); this.element.addEventListener("blur", this, false); this.element.addEventListener("keyup", this, false); } diff --git a/js/panels/properties.reel/sections/custom.reel/custom.js b/js/panels/properties.reel/sections/custom.reel/custom.js index 08434b01..9c31cf45 100755 --- a/js/panels/properties.reel/sections/custom.reel/custom.js +++ b/js/panels/properties.reel/sections/custom.reel/custom.js @@ -18,7 +18,6 @@ var Hottext = require("js/components/hottextunit.reel").HotTextUnit; var HT = require("js/components/hottext.reel").HotText; var Dropdown = require("js/components/combobox.reel").Combobox; var TextField = require("js/components/textfield.reel").TextField; -var FileInput = require("js/components/ui/file-input.reel").FileInput; var LabelCheckbox = require("js/components/ui/label-checkbox.reel").LabelCheckbox; var ColorChip = require("js/components/ui/color-chip.reel").ColorChip; var Button = require("montage/ui/button.reel").Button; @@ -322,8 +321,9 @@ exports.CustomSection = Montage.create(Component, { //Bind object value to controls list so it can be manipulated Object.defineBinding(this.controls, aField.id, { - boundObject: obj, - boundObjectPropertyPath: "value" + boundObject: obj, + boundObjectPropertyPath: "value", + oneway: false }); return obj; -- cgit v1.2.3