PDA

View Full Version : Proper way to load a Window Asynchronously


cdasher
05-02-2008, 01:48 PM
I have lots of windows which have forms etc on them. The data is loaded asynchronously from the server. When I call window.show() the form loads and then is kind of jittery when the data comes back from the rpc call. What is the proper way for loading and displaying data from an RPC call so that the window appears with the data already in it and has no jitter. Do I wait to call show until the call returns?

hendricd
05-02-2008, 02:20 PM
Yes, you could try making the RPC/AJax call in the Windows' beforeshow event, but return false (cancelling the event), showing the window only when the RPC results have been rendered.

cdasher
05-02-2008, 03:53 PM
Would this behave differntly than just calling show() when the RPC call returns? Also, which component needs to listen for the beforeShow event (I do not see that event fired in the API for Window) ?

hendricd
05-02-2008, 04:03 PM
Sorry, I thought this thread was Ext Help, not GWT Help. I don't know if GWT supports it yet, but if goal is to RPC, render, then show (so as to appear only when the Form is fully rendered), you may have to take matters into your own hands (outside of the Window event chain).

Perhaps:

1) Render the Window with hidden:true
2) Make RPC call
3) Render the form results to the Window
4) Window.show()

rodri_leon
11-28-2008, 11:23 AM
Hi, in my case i build the window components without any data and when the rpc success i load the data into them.
This means that window will show up more quickly.