diff options
author | Valerio Virgillito | 2012-06-25 13:29:57 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-06-25 13:29:57 -0700 |
commit | 4e5331c9967d4a24df56160188cc916a4051052b (patch) | |
tree | d769f2a5d962fc4122fc4a38d5afd10ea51d5c9c | |
parent | de38cd3479bd5865e058938095120fa3526fc9b3 (diff) | |
parent | 77ae7eac9c90ce4362a369bd4169607ee610c18d (diff) | |
download | ninja-4e5331c9967d4a24df56160188cc916a4051052b.tar.gz |
Merge pull request #333 from mencio/IKNINJA-1394
Fixing our textfield component to support binding. Fix for IKNINJA-1394
-rwxr-xr-x | js/components/textfield.reel/textfield.js | 23 | ||||
-rwxr-xr-x | js/panels/properties.reel/sections/custom.reel/custom.js | 6 |
2 files changed, 6 insertions, 23 deletions
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, { | |||
27 | }, | 27 | }, |
28 | set: function(value) { | 28 | set: function(value) { |
29 | this._value = value; | 29 | this._value = value; |
30 | this._valueSyncedWithInputField = false; | ||
30 | this.needsDraw = true; | 31 | this.needsDraw = true; |
31 | } | 32 | } |
32 | }, | 33 | }, |
@@ -41,7 +42,7 @@ exports.TextField = Montage.create(Component, { | |||
41 | 42 | ||
42 | handleBlur: { | 43 | handleBlur: { |
43 | value: function(event) { | 44 | value: function(event) { |
44 | this._value = this.element.value; | 45 | this.value = this.element.value; |
45 | this._valueSyncedWithInputField = true; | 46 | this._valueSyncedWithInputField = true; |
46 | 47 | ||
47 | var e = document.createEvent("CustomEvent"); | 48 | var e = document.createEvent("CustomEvent"); |
@@ -51,27 +52,10 @@ exports.TextField = Montage.create(Component, { | |||
51 | this.dispatchEvent(e); | 52 | this.dispatchEvent(e); |
52 | } | 53 | } |
53 | }, | 54 | }, |
54 | /* | ||
55 | handleChange: | ||
56 | { | ||
57 | value:function(event) | ||
58 | { | ||
59 | this._value = this.element.value; | ||
60 | this._valueSyncedWithInputField = true; | ||
61 | |||
62 | var e = document.createEvent("CustomEvent"); | ||
63 | e.initEvent("change", true, true); | ||
64 | e.type = "change"; | ||
65 | e.value = this._value; | ||
66 | this.dispatchEvent(e); | ||
67 | } | ||
68 | }, | ||
69 | */ | ||
70 | 55 | ||
71 | draw: { | 56 | draw: { |
72 | value: function() { | 57 | value: function() { |
73 | if(!this._valueSyncedWithInputField) | 58 | if(!this._valueSyncedWithInputField) { |
74 | { | ||
75 | this.element.value = this._value; | 59 | this.element.value = this._value; |
76 | this._valueSyncedWithInputField = true; | 60 | this._valueSyncedWithInputField = true; |
77 | } | 61 | } |
@@ -80,7 +64,6 @@ exports.TextField = Montage.create(Component, { | |||
80 | 64 | ||
81 | prepareForDraw: { | 65 | prepareForDraw: { |
82 | value: function() { | 66 | value: function() { |
83 | //this.element.addEventListener("change", this, false); | ||
84 | this.element.addEventListener("blur", this, false); | 67 | this.element.addEventListener("blur", this, false); |
85 | this.element.addEventListener("keyup", this, false); | 68 | this.element.addEventListener("keyup", this, false); |
86 | } | 69 | } |
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; | |||
18 | var HT = require("js/components/hottext.reel").HotText; | 18 | var HT = require("js/components/hottext.reel").HotText; |
19 | var Dropdown = require("js/components/combobox.reel").Combobox; | 19 | var Dropdown = require("js/components/combobox.reel").Combobox; |
20 | var TextField = require("js/components/textfield.reel").TextField; | 20 | var TextField = require("js/components/textfield.reel").TextField; |
21 | var FileInput = require("js/components/ui/file-input.reel").FileInput; | ||
22 | var LabelCheckbox = require("js/components/ui/label-checkbox.reel").LabelCheckbox; | 21 | var LabelCheckbox = require("js/components/ui/label-checkbox.reel").LabelCheckbox; |
23 | var ColorChip = require("js/components/ui/color-chip.reel").ColorChip; | 22 | var ColorChip = require("js/components/ui/color-chip.reel").ColorChip; |
24 | var Button = require("montage/ui/button.reel").Button; | 23 | var Button = require("montage/ui/button.reel").Button; |
@@ -322,8 +321,9 @@ exports.CustomSection = Montage.create(Component, { | |||
322 | 321 | ||
323 | //Bind object value to controls list so it can be manipulated | 322 | //Bind object value to controls list so it can be manipulated |
324 | Object.defineBinding(this.controls, aField.id, { | 323 | Object.defineBinding(this.controls, aField.id, { |
325 | boundObject: obj, | 324 | boundObject: obj, |
326 | boundObjectPropertyPath: "value" | 325 | boundObjectPropertyPath: "value", |
326 | oneway: false | ||
327 | }); | 327 | }); |
328 | 328 | ||
329 | return obj; | 329 | return obj; |