View Full Version : Buffered store requests don't trigger beforeload/load events

6 Jan 2014, 5:58 AM
Because our application has to cope with large sets of resources, we are using a buffered resource store for our ext scheduler.
For each data request we are getting the resources and events for the concerning number of resources.

We implemented a load event listener to be able to load the event store after new resource data has loaded.
Furthermore we implemented a beforeload event listener to be able to add a begin and enddate argument to the load request, so that we only get the events for the current viewport.

This works fine for the first data requests (2 in our case because we use a pagesize of 200) that are done to ensure that enough data is retrieved to fill the first pages.

When I start to scroll down, there comes a moment that new resource data requests are done.
This is indeed done. However, the beforeload and load event will not be triggered (although expected), which means that the begin- and enddate argument will not be added to the request any more, and the eventStore will not be loaded with new data.

Question is what may be the reason that these events are not executed? Do i have to implement other event to be able to add logic before or after new data has loaded?

Below the concerning code of the resource store:

extend: 'Sch.data.ResourceStore',
model: 'Scheduler.model.ResourceModel',

buffered: true,
pageSize: 200,
sorters: ['Code'],
remoteSort: true,
purgePageCount: 5,
leadingBufferZone: 200,
trailingBufferZone: 25,

autoLoad: true,

type: 'rest',
pageParam: false, //to remove param "page"
noCache: false, //to remove param "_dc"

url: 'REST/WebCharts/SchedulerChartDataWebService/getChartData',
type: 'json',
root: 'result.Resources',
totalProperty: 'result.TotalNrOfResources'

load: function ResourceStore_onLoad(store)
var data = store.proxy.reader.rawData;

beforeLoad: function ResourceStore_beforeLoad(store)
// TODO: add start and enddate argument to data request

6 Jan 2014, 6:43 AM
Take a look at the beforeprefetch and prefetch events. These events are fired when records are prefetched in a buffered store.

http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store-event-prefetch (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.data.Store-event-beforeprefetch)