-
26 Jan 2010 1:55 AM #1
Auto refresh of a Grid Data
Auto refresh of a Grid Data
Hello everyone, i'm quite new to Ext GWT, and i'm trying to figure something out.
In my app, I use a Grid to display some data which is loaded with a RpcProxy.
The data of the grid may be changing on the Server side, and i need to refresh this list everytime it does.
How can this be done in a clean way ? I couldn't find a way to refresh the list every X seconds, and I couldn't find a way to trigger the reload via a listener either.
Thanks in advance for your help, and sorry for my English, I'm french
Let me know if you need any more information.
Chazzz
Edit : Using 2.1.0, by the way
-
26 Jan 2010 3:24 AM #2
Hi.
You could use the timer to schedule a load. This should reload your store every 60 seconds.
(It's not tested, so I guess there are bugs in my small example)
Timer timer = new Timer() {
public void run() {
grid.getStore().getLoader().load();
}
};
timer.schedule(1000 * 60);
-
26 Jan 2010 4:14 AM #3
Thanks a lot, that is exactly what i was looking for.
Seems like if you want the timer to refresh itself like this :
final Timer timer = new Timer() {
public void run() {
loader.load();
schedule(1000);
}
};
timer.schedule(1000);
The loader needs to be final. No idea why though.
-
29 Jan 2010 9:38 AM #4
final, because the call of the loader in run is then later and thats why the loader object should not change any more.
This forum needs your help: you got hints from the community and now you have fixed your code? dont just reply with "now its fixed" or "i found the error"! please take the time to post also an detailed answer with the working code.
GreaseMonkey Script for a GXT-only Forum: it hides ExtJs here: New Posts • Search Results • Advanced Search form • Category overview http://www.extjs.com/forum/showthrea...041#post410041
-
29 Jan 2010 10:54 AM #5
Better:
Code:final Timer timer = new Timer() { public void run() { loader.load(); } }; timer.scheduleRepeating(1000 * 60);
-
5 Jun 2011 10:43 PM #6
Hi, I have pretty much the same setup as the OP and have the timer working. However, is there a way to not use the timer and only refresh the Grid when there's an update on the server side? (i.e., push notification)
-
10 Jun 2011 12:03 PM #7
Sure you can, but you need a comet implementation. Take a look at: http://code.google.com/p/gwt-comet/


Reply With Quote