Skip to content

Commit

Permalink
Issue-581 Emit new event "dgrid-page-complete"
Browse files Browse the repository at this point in the history
Similar to "dgrid-refresh-complete", but emitted after each page is loaded
within the Pagination extension.

Fixes dojo#581

Signed-off-by: Gordon Smith <gordon.smith@lexisnexis.com>
  • Loading branch information
GordonSmith committed Jan 15, 2014
1 parent c3daff8 commit d3a06c5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions extensions/Pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,23 @@ function(_StoreMixin, declare, arrayUtil, lang, Deferred, on, query, string, has
// A synchronous error occurred; reject the promise.
dfd.reject();
}

var self = this;
dfd.promise.then(function (results) {
// Emit on a separate turn to enable event to be used consistently for
// initial render, regardless of whether the backing store is async
setTimeout(function () {
on.emit(self.domNode, "dgrid-page-complete", {
bubbles: true,
cancelable: false,
grid: self,
page: page,
results: results // QueryResults object (may be a wrapped promise)
});
}, 0);

return results;
});
return dfd.promise;
}
});
Expand Down

0 comments on commit d3a06c5

Please sign in to comment.