HTTP Headers with ExtJS 4 Stores

I already have several stores. But at some point I would add an HTTP header in all of them. How can I do this with ExtJS 4?

+7
source share
3 answers

Assuming you are using an ajax proxy, you can update the headers property in the respective stores. Looking at the code, it will apply everything that is in the headers.

A more active solution should include overriding the doRequest function to do what suits you.

+4
source

The answer provided by wombleton is close, but the key is that you must set the headers property on the proxy server of the store, and not on the store itself, for example:

 Ext.StoreManager.lookup("MyStore").proxy.headers = { foo: "bar" } 

The next time you load the repository, the specified headers will be sent with the request.

+3
source

Ignore the undefined headers because the proxy has uninitialized headers, the headers are in the connection by default, but at the time of creating the request, your proxies (even implicit proxies) headers, given that you can do something like this:

 Ext.apply(myStore.proxy.headers, {headerName:headerValue}); 

Yours faithfully

0
source

All Articles