PDA

View Full Version : help me



zzsnake
24 Jun 2009, 8:01 AM
I use jquery ajax before ,and I can Loads data synchronously. Blocks the browser while the requests is active.
the question is how can I do it under gwt or gxt?

thanks

rdopico
26 Jun 2009, 12:10 AM
Take a look at the GWT RPC mechanism: http://code.google.com/intl/es-ES/webtoolkit/doc/1.6/DevGuideServerCommunication.html

Once you understand how it works, take a look at this: http://extjs.com/helpcenter/topic/com.extjs.gxt.help/html/reference/dataloading.html

Hope this helps :)

Colin Alworth
28 Jun 2009, 12:56 PM
If you want blocking AJAX using GWT, the short answer is that, yes, anything you do in javascript you can do in GWT, but no, support isnt available by default.

RPC (and other AJAXy stuff) is run using the RequestBuilder class, which uses a XMLHTTPRequest. If you absolutly cannot build your use case in such a way as to use the async callbacks as the resources that rdopico gave, you have (at least) two options.

- Sort of hard: Source in jQuery into your page, and hook into it using a bit of JSNI - this makse for uglier code, and you can no longer use GWT's RPC calls.
- Very hard: rebuild the RPC generator and backing code on the client to block when the xhr call goes off. The server wont be able to tell the difference if you do this properly, but your page will block while the request comes back. This is a lot of work, and to my knowledge, no one has done this yet.

While async code is harder to write, the end result is almost always better, both in terms of user experience and code.