make sure list can handle a selected id option that is not in the results
This commit is contained in:
parent
91c69d5d23
commit
19aa9b40e5
1 changed files with 11 additions and 6 deletions
|
@ -586,15 +586,19 @@ Ox.List = function(options, self) {
|
|||
//Ox.print('getPositionsCallback', result);
|
||||
var pos = 0;
|
||||
if (result) {
|
||||
$.extend(self, {
|
||||
positions: {},
|
||||
selected: []
|
||||
});
|
||||
self.options.selected = [];
|
||||
self.positions = {};
|
||||
self.selected = [];
|
||||
Ox.forEach(result.data.positions, function(pos, id) {
|
||||
// fixme: in case the order of self.options.selected
|
||||
// is important - it may get lost here
|
||||
self.options.selected.push(id);
|
||||
self.selected.push(pos);
|
||||
});
|
||||
if (self.selected.length) {
|
||||
pos = Ox.min(self.selected);
|
||||
self.page = getPageByPosition(pos);
|
||||
}
|
||||
} else if (self.stayAtPosition) {
|
||||
self.page = getPageByScrollPosition(self.stayAtPosition);
|
||||
}
|
||||
|
@ -726,6 +730,7 @@ Ox.List = function(options, self) {
|
|||
}
|
||||
|
||||
function loadPages(page, callback) {
|
||||
Ox.print('loadPages', page)
|
||||
var counter = 0,
|
||||
fn = function() {
|
||||
if (++counter == 3) {
|
||||
|
|
Loading…
Reference in a new issue