fixing bug where, if list is loaded with selection, the first list page would be displayed before scrolling to the selection

This commit is contained in:
rlx 2011-01-02 10:22:46 +00:00
parent bfcdda449a
commit 8235bf9767

View File

@ -6102,8 +6102,7 @@ requires
];
}
updateQuery();
self.options.selected.length && getPositions(self.options.selected);
updateQuery(self.options.selected);
Ox.print('s.o', self.options)
that.bindEvent(self.keyboardEvents);
$window.resize(that.size);
@ -6336,15 +6335,10 @@ requires
ids = ids || getSelectedIds();
// fixme: optimize: send non-selected ids if more than half of the items are selected
if (ids.length /*&& ids.length < self.listLength*/) {
alert('getPositions ' + JSON.stringify(ids) )
Ox.print('-------- request', {
ids: ids,
sort: self.options.sort
});
alert(JSON.stringify({
ids: ids,
sort: self.options.sort
}))
self.requests.push(self.options.request({
ids: ids,
sort: self.options.sort
@ -6358,7 +6352,6 @@ requires
Ox.print('getPositionsCallback', result)
var pos = 0;
if (result) {
alert('getPositionsCallback ' + JSON.stringify(result))
$.extend(self, {
ids: {},
selected: []
@ -6751,7 +6744,9 @@ requires
unloadPage(page + 1)
}
function updateQuery() {
function updateQuery(ids) {
// ids are the selcected ids
// (in case list is loaded with selection)
clear();
self.requests.push(self.options.request({}, function(result) {
var keys = {};
@ -6776,7 +6771,7 @@ requires
self.options.orientation == 'horizontal' ? 'width' : 'height',
self.listSize + 'px'
);
getPositions();
getPositions(ids);
}));
}