From 636f7728202b438614931365400e50342cff456a Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Mon, 19 Sep 2011 06:33:52 +0000 Subject: [PATCH] fix a bug where menus would modify item objects passed by reference --- source/Ox.UI/js/Form/Ox.Filter.js | 11 ++++------- source/Ox.UI/js/Form/Ox.OptionGroup.js | 4 +--- source/Ox.UI/js/Menu/Ox.MenuItem.js | 2 +- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/source/Ox.UI/js/Form/Ox.Filter.js b/source/Ox.UI/js/Form/Ox.Filter.js index d0c0b5d1..c20d8bc2 100644 --- a/source/Ox.UI/js/Form/Ox.Filter.js +++ b/source/Ox.UI/js/Form/Ox.Filter.js @@ -139,12 +139,9 @@ Ox.Filter = function(options, self) { width: 120 }), Ox.Select({ - /* items: self.options.sortKeys.map(function(sortKey) { - return {id: sortKey.id, title: sortKey.title[0]}; // fixme: title should not have become an array + return {id: sortKey.id, title: sortKey.title}; }), - */ - items: self.options.sortKeys, width: 128 }), Ox.FormElementGroup({ @@ -188,7 +185,7 @@ Ox.Filter = function(options, self) { ] }); - /* + ///* // fixme: sortKeys have been altered, probably by some select Ox.print('s.o.sK', self.options.sortKeys) self.$sort = Ox.InputGroup({ @@ -205,7 +202,7 @@ Ox.Filter = function(options, self) { {title: 'By default, sort by', width: 112} ] }); - */ + //*/ self.$save = Ox.InputGroup({ inputs: [ @@ -222,7 +219,7 @@ Ox.Filter = function(options, self) { ] }); - self.$items = [self.$operator, self.$limit, self.$view/*, self.$sort*/, self.$save]; + self.$items = [self.$operator, self.$limit, self.$view, self.$sort, self.$save]; self.$form = Ox.Form({ items: self.$items diff --git a/source/Ox.UI/js/Form/Ox.OptionGroup.js b/source/Ox.UI/js/Form/Ox.OptionGroup.js index 339304da..b2aa4150 100644 --- a/source/Ox.UI/js/Form/Ox.OptionGroup.js +++ b/source/Ox.UI/js/Form/Ox.OptionGroup.js @@ -2,6 +2,7 @@ /*@ Ox.OptionGroup OptionGroup + Helper object, used by ButtonGroup, CheckboxGroup, Select and Menu (items, min, max, property) -> OptionGroup items array of items min minimum number of selected items @@ -11,9 +12,6 @@ Ox.OptionGroup OptionGroup Ox.OptionGroup = function(items, min, max, property) { - /* - to be used by ButtonGroup, CheckboxGroup, Select and Menu - */ var length = items.length; property = property || 'checked'; max = max == -1 ? length : max; diff --git a/source/Ox.UI/js/Menu/Ox.MenuItem.js b/source/Ox.UI/js/Menu/Ox.MenuItem.js index ced2d346..def1fed6 100644 --- a/source/Ox.UI/js/Menu/Ox.MenuItem.js +++ b/source/Ox.UI/js/Menu/Ox.MenuItem.js @@ -36,7 +36,7 @@ Ox.MenuItem = function(options, self) { position: 0, title: [], }) - .options(Ox.extend(options, { + .options(Ox.extend(Ox.clone(options), { keyboard: parseKeyboard(options.keyboard || self.defaults.keyboard), title: Ox.toArray(options.title || self.defaults.title) }))