in Ox.List, trigger init after timeout, since otherwise a synchronous items function will trigger the event before one can bind to it

This commit is contained in:
rolux 2012-04-01 23:04:07 +02:00
parent 803985a160
commit 6a39bdd3bd

View file

@ -1287,7 +1287,11 @@ Ox.List = function(options, self) {
self.requests.push(self.options.items({}, function(result) {
var keys = {};
//Ox.Log('List', 'INIT!!!', result.data)
that.triggerEvent('init', result.data);
// timeout needed since a synchronous items function
// will reach here before one can bind to the init event
setTimeout(function() {
that.triggerEvent('init', result.data);
});
self.rowLength = getRowLength();
self.pageLength = self.options.orientation == 'both'
? self.pageLengthByRowLength[self.rowLength]