support list.options({selected: []})
This commit is contained in:
parent
07dd8d0190
commit
53fb84425e
1 changed files with 35 additions and 4 deletions
|
@ -5858,6 +5858,8 @@ requires
|
|||
self.onChange = function(key, value) {
|
||||
if (key == 'request') {
|
||||
that.$element.options(key, value);
|
||||
} else if (key == 'selected') {
|
||||
that.$element.options(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6125,7 +6127,6 @@ requires
|
|||
}
|
||||
|
||||
updateQuery(self.options.selected);
|
||||
Ox.print('s.o', self.options)
|
||||
that.bindEvent(self.keyboardEvents);
|
||||
$window.resize(that.size);
|
||||
|
||||
|
@ -6242,9 +6243,8 @@ requires
|
|||
function deselect(pos) {
|
||||
if (isSelected(pos)) {
|
||||
self.selected.splice(self.selected.indexOf(pos), 1);
|
||||
if (!Ox.isUndefined(self.$items[pos])) {
|
||||
!Ox.isUndefined(self.$items[pos]) &&
|
||||
self.$items[pos].removeClass('OxSelected');
|
||||
}
|
||||
triggerSelectEvent();
|
||||
}
|
||||
}
|
||||
|
@ -6744,6 +6744,35 @@ requires
|
|||
});
|
||||
}
|
||||
|
||||
function setSelected(ids) {
|
||||
if (ids.length == 0) {
|
||||
// fixme: can't use selectNone here,
|
||||
// since it'd trigger a select event
|
||||
$.each(self.$items, function(pos) {
|
||||
if (isSelected(pos)) {
|
||||
self.selected.splice(self.selected.indexOf(pos), 1);
|
||||
!Ox.isUndefined(self.$items[pos]) &&
|
||||
self.$items[pos].removeClass('OxSelected');
|
||||
}
|
||||
});
|
||||
}
|
||||
// fixme: implement the rest of this
|
||||
/*
|
||||
self.selected.forEach(function(pos) {
|
||||
if (value.indexOf(self.ids[pos]) == -1) {
|
||||
deselect(pos);
|
||||
}
|
||||
});
|
||||
value.forEach(function(id) {
|
||||
if (self.ids.indexOf(id) > -1) {
|
||||
addToSelection(pos)
|
||||
} else {
|
||||
|
||||
}
|
||||
});
|
||||
*/
|
||||
}
|
||||
|
||||
function toggleSelection(pos) {
|
||||
if (!isSelected(pos)) {
|
||||
addToSelection(pos);
|
||||
|
@ -6852,10 +6881,12 @@ requires
|
|||
Ox.print('list onChange', key, value);
|
||||
if (key == 'request') {
|
||||
updateQuery();
|
||||
} else if (key == 'selected') {
|
||||
setSelected(value);
|
||||
}
|
||||
};
|
||||
|
||||
that.clearCache = function() { // was used by TextList resizeColumn, now probably no longer necessary
|
||||
that.clearCache = function() { // fixme: was used by TextList resizeColumn, now probably no longer necessary
|
||||
self.$pages = [];
|
||||
return that;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue