Maybe Useful Modext Info for CMP Devs - Updating Store BaseParams

So I thought it might be useful for other CMP devs and save them some time if I left something I learned today here that took me a while to figure out.

I have a non paged grid with the usual textbox for sending a search query parameter to my processor. I found that when I cleared my search, removing the query property from my store’s baseParams object, that wasn’t changing what got posted to the server.

It seems that while adding parameter properties to the baseParams object updates the parameters posted to the server, modifying or removing existing ones doesn’t - even if you replace the entire baseParams object.

Eventually, I discovered that Ext sends an options object to the store reload method and unless you explicitly tell the store not to, it will just reuse the last options object it was fed for a successful load. You can explicitly cause the reload to use your newly modified baseParams properties before you call store.reload() as follows:

store.lastOptions = null;

I hadn’t come across this issue before because my grids were all paged and I was not directly reloading my store by using the grid’s getBottomToolbar.changePage() method to reload the store. I haven’t checked but I’m guessing changePage() nullifies the lastOptions object for you so the start parameter can be updated.

Hope someone finds all this useful.

1 Like

Great info. Thanks for posting that. :slight_smile:

1 Like