From 8235bf9767e37f037c2caab856a26013693354cd Mon Sep 17 00:00:00 2001 From: rlx <0x0073@0x2620.org> Date: Sun, 2 Jan 2011 10:22:46 +0000 Subject: [PATCH] fixing bug where, if list is loaded with selection, the first list page would be displayed before scrolling to the selection --- build/js/ox.ui.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/build/js/ox.ui.js b/build/js/ox.ui.js index d70004b..056610f 100644 --- a/build/js/ox.ui.js +++ b/build/js/ox.ui.js @@ -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); })); }