That looks correct, the OnSuccess shouldn't be called until the
performSearch has returned.

Have you checked the return value of Result? Is it null? or is it what
you set on the server side?

Have you debugged your way through this, put break points on your
server side and in the OnSuccess, to see if the server trips first?
Maybe you have a problem on your implementation you don't know about
and it's actually returning.

On Jul 23, 3:09 pm, Josephine <josephine.schwa...@gmail.com> wrote:
> I have what feels like it should be quite simple, but it is not
> working for me.  I have a button with a clickListener and an onClick
> method.  In the onClick method, there are AsyncCallback's requisite
> onSuccess and onFailure methods  to perform a search on the server.
> The search works fine and the onSuccess method is certainly called,
> but it seems to be called IMMEDIATELY - it does not wait for the
> AsyncCallback to finish.  This is making me crazy.  Every code snippet
> I've examined  looks exactly like what I'm doing.  Can anyone help
> me?  Do I misunderstand onSuccess?  Is it correct that it is called
> immediately?
>
> Here's a snippet of my code...
> [code]
> public class Audit implements EntryPoint, TabListener {
>
>     final Button submit = new Button("Submit");
>     final Button reset = new Button("Reset");
>
>     public void onModuleLoad() {
>          setupFinalSearchButtons();
>          //do other stuff....
>     }
>
>    private void setupFinalSearchButtons() {
>
>                 //do other stuff here....
>
>                 submit.addClickListener(new ClickListener() {
>                         public void onClick(Widget sender) {
> AsyncCallback<Boolean> callback = new AsyncCallback<Boolean>() {
>
>                     public void onFailure(Throwable caught) {
>                         Window.alert("Failed to perform search!");
>                     }
>
>                     public void onSuccess(Boolean result) {
>                         Window.alert("onSuccess!");
>                     }
>                 };
>                 AuditServiceProvider provider = new
> AuditServiceProvider();
>                 AuditServiceAsync svc = (AuditServiceAsync)
> provider.getAuditServiceInstance();
>                 svc.performSearch(auditUIParams, callback);
>      }
>     //more stuff....}
>
> [/code]
>
> My understanding is that Window.alert("onSuccess!"); should not
> execute until svc.performSearch(auditUIParams, callback); is complete.
> Am I correct?  If so, why isn't the code doing that??
>
> Thanks for any help in advance,
> Josephine
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to Google-Web-Toolkit@googlegroups.com
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to