Opened 12 years ago
Closed 12 years ago
#9199 closed defect (invalid)
QueryReadStore uses onBegin as a callback on ajax requests vs before xhr call
Reported by: | mitechie | Owned by: | Jared Jurkiewicz |
---|---|---|---|
Priority: | high | Milestone: | tbd |
Component: | DojoX Data | Version: | 1.3.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
I'm trying to hook into onBegin/onComplete for a QueryReadStore? instance tied to a data grid.
The store's fetch() method creates a _fetchHandler passed to the _fetchItems() method. The _fetchItems() method then turns the fetchHandler into a callback to the xhr request since we're not using clientPaging.
This ends up turning the onBegin() hook into a hook that doesn't run until the ajax request is complete.
In my test I extended the grid and overrode the onFetchBegin/Complete methods. http://paste2.org/p/190769
I just added a console.log() to each. Both of those only run *after* a grid.filter() update has completed the ajax request.
This leaves me no method to hook into performing any action at the start of a grid.filter() call.
onBegin cannot fire until after the XHR call returns. onBegin's callback takes the parameter of size, as in how large was the total resultset. That cannot be known until after the XHR call for QueryReadStore?.
The store is operating within spec.
Why not, when extending datagrid, that you over-ride the filter call, then do something like:
filter: function() {
}
That way you run stuff before you call up to the superclass filtering.