fix setting items and sort at the same time

This commit is contained in:
j 2014-02-07 08:37:46 +00:00
parent ddb6165a76
commit 45155f1f71

View file

@ -833,7 +833,11 @@ Ox.List = function(options, self) {
var keys = Ox.unique(self.options.keys.concat(self.options.unique)),
offset = page * self.pageLength,
range = [offset, offset + getPageLength(page)];
if (Ox.isUndefined(self.$pages[page])) { // fixme: unload will have made this undefined already
if (!Ox.isUndefined(self.$pages[page])) {
Ox.Log('List', 'fixme: unload should have made this undefined already');
}
self.$pages[page] = constructEmptyPage(page);
page == 0 && fillFirstPage();
self.$pages[page].appendTo(that.$content);
@ -864,14 +868,10 @@ Ox.List = function(options, self) {
self.$pages[page].appendTo(that.$content);
!Ox.isUndefined(callback) && callback(); // fixme: callback necessary? why not bind to event?
}));
} else {
//Ox.Log('List', 'loading a page from cache, this should probably not happen -----------')
self.$pages[page].appendTo(that.$content);
}
}
function loadPages(page, callback) {
Ox.Log('List', 'loadPages', page)
Ox.Log('List', 'loadPages', page);
var counter = 0,
fn = function() {
if (++counter == 3) {
@ -1409,7 +1409,6 @@ Ox.List = function(options, self) {
function updateQuery(callback) { // fixme: shouldn't this be setQuery?
var data;
clear(); // fixme: bad function name ... clear what?
self.requests.push(data = self.options.items({
query: self.options.query
}, function(result) {
@ -1418,6 +1417,7 @@ Ox.List = function(options, self) {
// will reach here before one can bind to the init event,
// and before any sizes can be determined via the DOM
setTimeout(function() {
clear(); // fixme: bad function name ... clear what?
that.triggerEvent(
'init',
Ox.extend(