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