PDA

View Full Version : Updatng Grid with a new HttpProxy



longer
2 Nov 2008, 11:18 AM
All,

I've been using the com.extjs.gxt.ui.client.widget.grid.Grid object in a similar fashion to the example given in the http://www.extjs.com/explorer/#xmlgrid and everything works great during the initial data load.

Is there a standard way to update the HttpProxy and have a new dataset display in the table? All my efforts to point the http proxy to a different XML file show a stubborn Grid that just displays the initial XML.

My work around is to re-create a Grid with a new XMLReader, BaseListLoader, ListStore etc. which *has* to be the wrong approach but I can't get BaseListLoader.load() to recognize any changes to the http proxy.

Maybe I am going about this all wrong so does anybody know how to update a grid with a new and different http request? Example somewhere?

Thanks in advance for any help!


.Chris

gslender
2 Nov 2008, 12:43 PM
What about store.removeAll() and the loader.load();

longer
3 Nov 2008, 12:59 PM
What about store.removeAll() and the loader.load();

I tried calling removeAll on the store, no luck, removeAll doesn't seem to remove the proxy.

posta07
3 Nov 2008, 5:47 PM
This looks like something you'll have to implement yourself (Darrell, correct me if I'm wrong), although I doubt it would be too hard.

Extend the HttpProxy class, and then add a method to mutate the 'initUrl' member variable.

Let us know what you decide to go with...

Cheers

longer
4 Nov 2008, 7:47 AM
I figured I would have to do something like this, it's unfortunate that this isn't more directly supported. I will post back what I end up doing and if it works of course.

Thanks!

.Chris

longer
4 Nov 2008, 8:38 AM
Changing the member variable in the HttpProxy class has no effect, I am going to read more of the source to figure out what the heck is going on. ~o)

Anymore tips would be appreciated! Subclass code below

.Chris

public class DemographicHttpProxy<C, D> extends HttpProxy<C, D>{

/**
* Creates a new HttpProxy.
*
* @param builder the request builder
*/
public DemographicHttpProxy (RequestBuilder builder) {
super(builder);

}

public void setHttpProxyURL(String url){
super.initUrl = url;
}

public String getHttpProxyURL(){
return super.initUrl;
}
}

shermdog01
10 Nov 2008, 5:54 PM
I used reconfigure to display updated data:

grid.reconfigure(store, cm);

longer
11 Nov 2008, 6:47 AM
For me I had manually update the view, the reconfigure method doesn't call it for some reason. Works fine now.

loader.load();
grid.reconfigure(demographicStore,demographicCM);
grid.getView().refresh(false);