PDA

View Full Version : dynamic HttpProxy url in grid



mikedanese
25 Sep 2007, 10:32 AM
I am trying to update an Ext.js grid based on a page parameter, which gets appended to a url. However, the dataStore.reload just returns data as per the original url. How can I update the dataStore proxy url at request time? Do I have to rewrite code to use Ext.js.Connection_ which seems to accomodate this need.

eg:
dataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:./server/AjaxReqHandler?cmd=report&id='+cid}), ...

Animal
26 Sep 2007, 12:07 AM
You don't mean change the URL do you? You mean add or change parameters.

If you read the docs for reload, you'll see it says "An object containing properties which may override the options used in the last load operation. See load for details" and kindly includes a link to load:

http://www.extjs.com/deploy/ext/docs/output/Ext.data.Store.html#load

And there you will find:



Parameters:

* options : Object
An object containing properties which control loading options:
* params {Object} An object containing properties to pass as HTTP parameters to a remote data source.

crafter
27 Sep 2007, 8:11 AM
You don't mean change the URL do you? You mean add or change parameters.

I need a solution for this, where I DO need to change the URL, as the server accepts a "search engine friendly" URL.



dataStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({url:./server/product/'+product_id}), ...

fay
27 Sep 2007, 8:16 AM
http://extjs.com/forum/showthread.php?p=67092#post67092

http://extjs.com/forum/showthread.php?p=67086#post67086

crafter
27 Sep 2007, 9:53 AM
I came back to report a hint of a solution, and see that Fay has already provided some good pointers.

Look here also : http://extjs.com/forum/showthread.php?t=5504&highlight=reload+grid+datastore