PDA

View Full Version : Reload a Grid



m5md
2 Sep 2009, 9:13 AM
Hi,

I am new to GXT, we are exploring replacing our YUI based UI with GXT. We love the widgets and GXT.

I am essentially using the XMLGrid example from the GXT explorer demo (http://www.extjs.com/examples/#xmlgrid). The change i made was to change the proxy URL load data from a REST service that returned XML. So far so good.

I then added a listener to the grid to handle a mouse click which then made a POST to another REST service to make updates.

What I now need to do on POST success, is to reload the entire grid again to reflect the updated status of the record(s), including those that may have been made by other users.

The first call to loader.load() works, but any subsequent call to the loader.load() in response to the user clicks seems to return data cached from the first call.

In fact, it succeeds even if I shut down the REST service!. Hitting the REST url directly correctly returns the updated data, so I have eliminated that possibility.

I have implemented a LoadListener for the Loader and the loaderLoadException method is never invoked.

Thanks,

Arno.Nyhm
2 Sep 2009, 9:39 AM
look here:
http://groups.google.com/group/google-web-toolkit/browse_frm/thread/98b2050a7f72011c/6c34228a1c815e00?lnk=gst&q=requestbuilder+cache#6c34228a1c815e00



RequestBuilder builder = new RequestBuilder(RequestBuilder.GET,
"yourPath?yourCgiParams=yourValues");
builder.setHeader("Cache-Control", "no-cache");


or
http://www.gwt-ext.com/forum/viewtopic.php?p=3472#p3472



RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,
"../loginUtil.jsp?action=getInitData&rnd=" + new Date().getTime());

m5md
2 Sep 2009, 10:13 AM
Well, that was quick.

Your tip ( the first one ) solved the problem.

I suspected as much, but I was thrown off track because the Hosted mode browser ( IE) was having the problem and I didn't think of trying it out in Firefox. What I did test in Firefox was that the REST service was indeed returning the right data.

We do have caching turned off in the REST service responses, but coincidentally missed it in that particular one.

Thanks for the help.