View Full Version : EditorGridPanel and HttpProxy: How to change the proxy URL dynamically ?

11 Sep 2010, 4:23 AM
var OrderPositionsGridStore = new Ext.data.GroupingStore({
id: 'OrderPositionsGridStore',
reader: new Ext.data.JsonReader({
idProperty: 'OrderPositionsGridStoreReader',
fields: [
{name: 'ID'},
{name: 'name'},
root: 'data',
remoteGroup: true,
remoteSort: true
proxy : new Ext.data.HttpProxy({
url: 'order.php?action=getOrderPosition&OrderID=1',
method: 'POST'
sortInfo: {field: 'name', direction: 'ASC'},
groupField: 'name'

var OrderPositionsGrid = new Ext.grid.EditorGridPanel({
border: false,
ds: OrderPositionsGridStore,
columns: [ ... ]
[.. more settings ..]
How can i change the GroupingStore-URL dynamically on runtime ?
(the OrderID should be taken from a javascript var)

I tried several ways now - the script is executing the right URL - but the results (received data from the script) were not shown in the grid.

Some ideas ?

11 Sep 2010, 4:55 AM
var id = id //gra. ur id here
grid.store.proxy. conn.url = 'ur url?orderId=' + id;

11 Sep 2010, 5:12 AM
Thank your for your answer - but: no, it is not working.

I also tried out

var ST = OrderPositionsGridStore;
ST.proxy.setUrl('url.php?param=1', true); Also without success.

11 Sep 2010, 5:39 AM
hope u r reloading the store after setting the url.
grid.store.reload() or urstorename.reload().

11 Sep 2010, 6:21 AM
You're not changing the URL, you're changing PARAMETERS.

Use a beforeload event listener

11 Sep 2010, 6:48 AM
Now i use

beforeload: {
fn: function (store, options) {
// use {@link Ext.data.HttpProxy#setUrl setUrl} to change the URL for *just* this request.
var link = 'order.php?action=getOrderPositions&OrderID=' + CurrentOrderID;
store.proxy.setUrl(link, true);

The alert-Message displays me the correct link. Everything seems fine.
But now the retrieved data are being displayed in the Ext.grid.EditorGridPanel.

Argh !

What am i doing wrong ??

11 Sep 2010, 6:51 AM
Thank you animal (one more time) :o)

With the beforelistener event it is working now.
Ticket can be closed.

11 Sep 2010, 7:31 AM
thanx animal.... and snoop

11 Sep 2010, 7:36 AM
So you are actually setting the params in the options, then, not messing with a URL?

11 Sep 2010, 7:50 AM
So what you actually want is:

var store = new Ext.data.Store({
url: 'order.php',
method: 'GET',
baseParams: {
action: 'getOrderPositions'
reader: ...
params: {
OrderID: CurrentOrderID