diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 55418d24..1bbbc717 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -1215,6 +1215,18 @@ Ox.List = function(options, self) { })); } + function updateSelected() { + var oldSelectedIds = getSelectedIds(), + newSelectedIds = []; + Ox.forEach(self.options.items, function(item) { + if (oldSelectedIds.indexOf(item.id) > -1) { + newSelectedIds.push(item.id); + } + return newSelectedIds.length < oldSelectedIds.length; + }); + setSelected(newSelectedIds); + } + function updateSort(map) { Ox.print('start sort') var key = self.options.sort[0].key, @@ -1243,8 +1255,10 @@ Ox.List = function(options, self) { self.setOption = function(key, value) { //Ox.print('list setOption', key, value); + var selectedIds; if (key == 'items') { if (Ox.typeOf(value) == 'array') { + updateSelected(); updateSort(); } else { updateQuery();