From 6a39bdd3bdb89a72119c396ac575f452798b255c Mon Sep 17 00:00:00 2001 From: rolux Date: Sun, 1 Apr 2012 23:04:07 +0200 Subject: [PATCH] in Ox.List, trigger init after timeout, since otherwise a synchronous items function will trigger the event before one can bind to it --- source/Ox.UI/js/List/Ox.List.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/source/Ox.UI/js/List/Ox.List.js b/source/Ox.UI/js/List/Ox.List.js index 855c3912..8ea8103a 100644 --- a/source/Ox.UI/js/List/Ox.List.js +++ b/source/Ox.UI/js/List/Ox.List.js @@ -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]