From d57affea4a6218995244fe75203e3566699e87e3 Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sat, 30 Jun 2012 15:05:05 +0000 Subject: [PATCH] Ox.List: change 'selected' update handler --- source/Ox.UI/js/List/List.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/source/Ox.UI/js/List/List.js b/source/Ox.UI/js/List/List.js index 86ea3c61..1653c2ac 100644 --- a/source/Ox.UI/js/List/List.js +++ b/source/Ox.UI/js/List/List.js @@ -109,13 +109,11 @@ Ox.List = function(options, self) { }, selected: function() { var previousSelected = Ox.clone(self.selected); - setSelected(self.options.selected); - // fixme: the following was added in order - // to make table list find-as-you-type work, - // this may break other things - if (/*!self.isAsync && */!Ox.isEqual(self.selected, previousSelected)) { - triggerSelectEvent(self.options.selected); - } + setSelected(self.options.selected, function() { + if (!Ox.isEqual(self.selected, previousSelected)) { + triggerSelectEvent(self.options.selected); + } + }); }, sort: function() { updateSort(); @@ -1207,7 +1205,6 @@ Ox.List = function(options, self) { } function setSelected(ids, callback) { - // fixme: no case where callback is set // note: can't use selectNone here, // since it'd trigger a select event Ox.Log('List', 'SET SELECTED', ids) @@ -1725,11 +1722,10 @@ Ox.List = function(options, self) { (id) -> returns all values of id id id of item key key if item property - value value, can be whatever that property is + value <*> value, can be whatever that property is @*/ that.value = function(id, key, value) { // id can be a number and will then be interpreted as position - Ox.Log('List', 'that.value id key value', id, key, value) var pos = Ox.isNumber(id) ? id : getPositionById(id), $item = self.$items[pos], data = $item ? $item.options('data') : {};