PDA

View Full Version : [Solved] Disable caching in Combo data store



brunod
2 Nov 2009, 2:06 PM
[using Ext 3.0]

Hi, I have another question and thought it would be more relevant to post it separately rather than lumped with my other question (they are two separate topics).

I have a combo with a HttpProxy as a DataStore and it seems like the data store caches results received from the server. The problem is this combo is dynamic and caching seems to prevent the combo from firing an http request to the server when I'd like it to (basically, always). How can I disable this caching of results completely?

brunod
2 Nov 2009, 2:15 PM
As an aside, we are considering purchasing a license to Ext 3.0 with support, but before we do that I have the task of building this example using our live data to show my management and prove them the value of using Ext JS as a replacement for our current UI widgets.

aw1zard2
2 Nov 2009, 2:29 PM
You can set the combobox to a local mode and manually reload your store for the combo. Also read lastQuery in the combo box documentation.

http://www.extjs.com/deploy/dev/docs/?class=Ext.form.ComboBox&member=mode (http://www.extjs.com/forum/../deploy/dev/docs/?class=Ext.form.ComboBox&member=mode)

brunod
3 Nov 2009, 9:46 AM
Thanks,

however those look like workarounds. I'm not at work right now but will try these asap. Isn`t there a built-in config option or way to disable this caching?

As shown in my example there are definitely use cases for this, I would say this should be a standard feature if it isn't already.

aw1zard2
3 Nov 2009, 9:51 AM
They aren't work-arounds but examples inside the documentation.
It would be a work-around if they was posted in the forums not the API docs.

:)

brunod
3 Nov 2009, 10:07 AM
Just because something's in the API doc doesn't mean it's the right & logical way of doing things. When dealing with remote data, why assume people would necessarily want caching? Caching is an added bonus, but it shouldn't be part of the basic configuration, especially when developping / debugging things imho.

Thanks for your help anyways, but I would rather like to find a way to turn it off completely in the config.

aw1zard2
3 Nov 2009, 11:01 AM
disableCaching can be set inside the connection.

Looking at the httpproxy the conn object can use the Ext.Ajax.request or Ext.data.Connection they both have the option available.

http://www.extjs.com/deploy/dev/docs/?class=Ext.Ajax&member=request (http://www.extjs.com/forum/../deploy/dev/docs/?class=Ext.Ajax&member=request)

in which disableCaching is an option.

brunod
4 Nov 2009, 8:04 AM
Thanks again for your help.

I tried 2 of your suggestions (did not try the manual loading of data), deleting the lastQuery parameter did the trick. The last suggestion did not work (and was expecting so, since the docs say that the "disableCaching" parameter is set to true by default).

As a FYI, I think your last suggestion refers to browser caching, meaning that browsers look at the URL and if it's the same as just previously asked they might not send another request to the server and just reload the previously cached response data (assuming the server allows caching in its http headers). Not 100% sure, but it seems like that from what I've read in the docs (and is typical for Ajax requests frameworks to add some parameter to the URL, typically a timestamp for example, to lure browsers into thinking this isn't the same page as previously asked).

I still wish there was a more logical way of doing this (in config), and I'm surprised this isn't more explicit in the docs as I think this should be a standard feature.