From 8c4e7fbe849ab1ec1dbca41d36d3918fab3af87f Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 18 May 2014 02:45:34 +0200 Subject: [PATCH] select input: fix size, keep input value around --- source/Ox.UI/js/Form/SelectInput.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/Ox.UI/js/Form/SelectInput.js b/source/Ox.UI/js/Form/SelectInput.js index 3c98ad25..5fc70489 100644 --- a/source/Ox.UI/js/Form/SelectInput.js +++ b/source/Ox.UI/js/Form/SelectInput.js @@ -11,6 +11,7 @@ Ox.SelectInput = function(options, self) { var that; self = Ox.extend(self || {}, { options: Ox.extend({ + inputValue: '', inputWidth: 128, items: [], label: '', @@ -25,7 +26,7 @@ Ox.SelectInput = function(options, self) { }); self.other = self.options.items[self.options.items.length - 1].id; - self.otherWidth = self.options.width - self.options.inputWidth - 3; // fixme: 3? obscure! + self.otherWidth = self.options.width - self.options.inputWidth; self.$select = Ox.Select({ items: self.options.items, @@ -46,7 +47,8 @@ Ox.SelectInput = function(options, self) { self.$input = Ox.Input({ placeholder: self.options.placeholder, - width: 0 + width: self.options.inputWidth, + value: self.options.inputValue }) .bindEvent({ change: function(data) { @@ -114,7 +116,7 @@ Ox.SelectInput = function(options, self) { width: self.options.width }) .removeClass('OxOverlapRight'); - self.$input.hide().value(''); + self.$input.hide(); } else { self.$select.options({ title: Ox.getObjectById(self.options.items, self.other).title, @@ -122,7 +124,7 @@ Ox.SelectInput = function(options, self) { width: self.otherWidth }) .addClass('OxOverlapRight'); - self.$input.show().value(self.options.value).focusInput(); + self.$input.show().focusInput(true); } self.$select.options({title: getTitle()}); }