PDA

View Full Version : Preventing GUI freeze while loading data



Payam
1 Jul 2008, 1:01 PM
Hello,

I have a time consuming table which I fill up with alot of data.
However, while it is filling up, my GUI is frozen.
You can try it with:
http://www.extjs.com/explorer/#xmltable
While it is loading, try hovering over buttons on the left, its unresponsive.

In Java Swing, I'd just create a worker thread to do the filling.
How do I achieve this in EXT GWT?

My only solution was to use the Timer class during fill up and schedule itself constantly.
Eg.


Timer timer = new Timer() {
private int i = 0;
public void run() {
Info.display("Test", "Timer called: " + i, "");
i++;
this.schedule(1000);
}
};
timer.schedule(100);
(This is an infinite loop though, but you can easily put break conditions)
Using logic like this for table fill up, after each entry, there can be a 5 millisecond wait. This would allow other events to be processed, preventing GUI freeze up.

Is there a better way of achieving this?

gslender
1 Jul 2008, 1:09 PM
Nope - the issue here is that the UI is busy rendering and as such, there is not much you can do. The new grid will hopefully render faster and won't have this problem.

The actual load (HTTP) doesn't cause the issue and is async... you can see this in http://extjs.com/explorer/#pagingtable demo. The loading in the table (after the RPC fetch) still has the problem, but the RPC call 1st still allows the UI to continue.

Payam
1 Jul 2008, 1:51 PM
Thanks :D
In that case, I guess I got to be patient for the Grid update like everyone else ;)