Ox.List: change 'selected' update handler

This commit is contained in:
rlx 2012-06-30 15:05:05 +00:00
parent f5901e4a1d
commit d57affea4a

View file

@ -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) -> <o> returns all values of id
id <s> id of item
key <s> key if item property
value <s> 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') : {};