improve listmap editing functionality
This commit is contained in:
parent
b17e8a783b
commit
0e5172a8fa
1 changed files with 14 additions and 0 deletions
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue