From 15444fe5a94d8a8da29d7a4b09aa8f6323d6403e Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 16 Feb 2014 07:06:48 +0000 Subject: [PATCH] handle update of label option --- source/Ox.UI/js/Form/Checkbox.js | 3 +++ source/Ox.UI/js/Form/Input.js | 2 ++ source/Ox.UI/js/Form/Select.js | 3 +++ source/Ox.UI/js/Form/SelectInput.js | 3 +++ 4 files changed, 11 insertions(+) diff --git a/source/Ox.UI/js/Form/Checkbox.js b/source/Ox.UI/js/Form/Checkbox.js index e90cd837..2d8dd19a 100644 --- a/source/Ox.UI/js/Form/Checkbox.js +++ b/source/Ox.UI/js/Form/Checkbox.js @@ -37,6 +37,9 @@ Ox.Checkbox = function(options, self) { self.$button.options({disabled: disabled}); self.$title && self.$title.options({disabled: disabled}); }, + label: function() { + self.$label.options({title: self.options.label}); + }, title: function() { self.$title.options({title: self.options.title}); }, diff --git a/source/Ox.UI/js/Form/Input.js b/source/Ox.UI/js/Form/Input.js index 26a674a9..e0d2cd01 100644 --- a/source/Ox.UI/js/Form/Input.js +++ b/source/Ox.UI/js/Form/Input.js @@ -122,6 +122,8 @@ Ox.Input = function(options, self) { } else if (key == 'height') { that.css({height: value + 'px'}); self.$input.css({height: value - 6 + 'px'}); + } else if (key == 'label') { + self.$label.options({title: value}); } else if (key == 'labelWidth') { self.$label.options({width: value}); inputWidth = getInputWidth(); diff --git a/source/Ox.UI/js/Form/Select.js b/source/Ox.UI/js/Form/Select.js index e52163a7..0588c417 100644 --- a/source/Ox.UI/js/Form/Select.js +++ b/source/Ox.UI/js/Form/Select.js @@ -53,6 +53,9 @@ Ox.Select = function(options, self) { // fixme: make default selection restorable .options(options) .update({ + label: function() { + self.$label.options({title: self.options.label}); + }, labelWidth: function() { self.$label.options({width: self.options.labelWidth}); self.$title.css({width: getTitleWidth() + 'px'}); diff --git a/source/Ox.UI/js/Form/SelectInput.js b/source/Ox.UI/js/Form/SelectInput.js index fb926237..3c98ad25 100644 --- a/source/Ox.UI/js/Form/SelectInput.js +++ b/source/Ox.UI/js/Form/SelectInput.js @@ -76,6 +76,9 @@ Ox.SelectInput = function(options, self) { width: self.options.width }) .update({ + label: function() { + self.$select.options({label: self.options.label}); + }, value: function() { self.options.value = that.options('value'); setValue();