in a list's init event, pass the query if the async items function immediately returns one

This commit is contained in:
rolux 2013-02-16 15:01:27 +05:30
parent 5227dbc166
commit 2a7c20a043

View file

@ -1392,8 +1392,9 @@ 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(self.options.items({
self.requests.push(data = self.options.items({
query: self.options.query
}, function(result) {
var keys = {};
@ -1402,7 +1403,11 @@ Ox.List = function(options, self) {
// and before any sizes can be determined via the DOM
setTimeout(function() {
that.triggerEvent(
'init', Ox.extend(result.data, {query: self.options.query})
'init',
Ox.extend(
result.data,
data && data.query ? {query: data.query} : {}
)
);
self.rowLength = getRowLength();
self.pageLength = self.options.orientation == 'both'