View Full Version : Conditionally allow store to load

1 Aug 2013, 9:30 AM
I have a situation where I want to have the store.load only execute the remote loading if a request parameter has changed.

I have a use case where a grid of records has a dependent grid based on the selected record of the parent grid.

There are records in the main grid which essentially have the same detail grid.

Today, I have checks in my controller (and the dependent grid) to see if the master grid's selected record values of interest are different than what the dependent grid's "bound record" is.

I have been doing this all over the place, and was looking to put something into the store to just not bother loading unless its the initial load, forced load, or a parameter has changed (meaning I can expect a different set of results from the server).

I have not had much luck. It seems that store.lastOptions are already replaced by the time it gets to beforeload event.

So, I am hoping to find some suggestions (or UX's) that accomplish this at the store/proxy level for me; so I do not have the put code checks on every place I have a store that should conditionally reload.

Thanks, in advance, for any suggestions/pointers.

1 Aug 2013, 10:02 AM
take a look at the beforeload event:

you can check for your business logic and return false in case you do not want to execute the load.

best regards

1 Aug 2013, 12:08 PM
Unfortunately, when beforeload is run .. lastOptions have already been replaced in the AbstractStore.load