From 84e7e794f79343af3ad68bcc10b767a9d8e619f6 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Fri, 23 Dec 2011 09:54:20 +0000 Subject: [PATCH] misc bugfixes --- source/Ox.UI/js/Form/Ox.Checkbox.js | 2 +- source/Ox.UI/js/Form/Ox.Select.js | 13 +++++-------- source/Ox.UI/js/List/Ox.TextList.js | 14 ++++++++------ 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/source/Ox.UI/js/Form/Ox.Checkbox.js b/source/Ox.UI/js/Form/Ox.Checkbox.js index fddf7620..40d9bc3c 100644 --- a/source/Ox.UI/js/Form/Ox.Checkbox.js +++ b/source/Ox.UI/js/Form/Ox.Checkbox.js @@ -106,7 +106,7 @@ Ox.Checkbox = function(options, self) { } else if (key == 'title') { self.$title.options({title: value}); } else if (key == 'value') { - self.$button.toggleTitle(); + self.$button.toggle(); } else if (key == 'width') { that.css({width: value + 'px'}); self.$title && self.$title.options({width: getTitleWidth()}); diff --git a/source/Ox.UI/js/Form/Ox.Select.js b/source/Ox.UI/js/Form/Ox.Select.js index 866ea941..42bd5a17 100644 --- a/source/Ox.UI/js/Form/Ox.Select.js +++ b/source/Ox.UI/js/Form/Ox.Select.js @@ -76,14 +76,14 @@ Ox.Select = function(options, self) { self.options.items = self.options.items.map(function(item) { return Ox.isEmpty(item) ? item : { - id: item.id || item, - title: item.title || item, - checked: Ox.toArray(self.options.value).indexOf(item.id || item) > -1 + id: 'id' in item ? item.id : item, + title: 'title' in item ? item.title : item, + checked: Ox.toArray(self.options.value).indexOf( + 'id' in item ? item.id : item + ) > -1 }; }); - Ox.Log('Form', 'S.O.V.', '"'+self.options.value+'"', JSON.stringify(self.options.items)) - self.optionGroup = new Ox.OptionGroup( self.options.items, self.options.min, @@ -93,8 +93,6 @@ Ox.Select = function(options, self) { self.options.items = self.optionGroup.init(); self.options.value = self.optionGroup.value(); - Ox.Log('Form', 'S.O.V.', '"'+self.options.value+'"', JSON.stringify(self.options.items)) - if (self.options.label) { self.$label = Ox.Label({ overlap: 'right', @@ -154,7 +152,6 @@ Ox.Select = function(options, self) { function changeMenu(data) { self.options.value = self.optionGroup.value(); - Ox.Log('Form', 'changeMenu: ', data, 'value:', self.options.value, 'checked:', self.optionGroup.checked()) self.$title && self.$title.html( self.options.title ? self.options.title : getItem(self.options.value).title ); diff --git a/source/Ox.UI/js/List/Ox.TextList.js b/source/Ox.UI/js/List/Ox.TextList.js index ae4003f5..d1e3829b 100644 --- a/source/Ox.UI/js/List/Ox.TextList.js +++ b/source/Ox.UI/js/List/Ox.TextList.js @@ -162,7 +162,6 @@ Ox.TextList = function(options, self) { id: self.options.id + 'SelectColumns', items: self.options.columns.map(function(column) { return { - checked: column.visible, disabled: column.removable === false, id: column.id, title: column.title @@ -170,7 +169,10 @@ Ox.TextList = function(options, self) { }), max: -1, min: 1, - type: 'image' + type: 'image', + value: Ox.map(self.options.columns, function(column) { + return column.visible ? column.id : null; + }) }) .bindEvent('change', changeColumns) .appendTo(that.$bar.$element); @@ -265,14 +267,14 @@ Ox.TextList = function(options, self) { function changeColumns(data) { var add, ids = []; - Ox.forEach(data.value, function(column) { - var index = getColumnIndexById(column.id); + Ox.forEach(data.value, function(id) { + var index = getColumnIndexById(id); if (!self.options.columns[index].visible) { - addColumn(column.id); + addColumn(id); add = true; return false; } - ids.push(column.id); + ids.push(id); }); if (!add) { Ox.forEach(self.visibleColumns, function(column) {