Thursday, January 23, 2014

Re: Is it the best practice to put the loadingMessage code in the prepareFromRequest method in (GWTP)

I solved the problem, just put the callingMethod inside onReset, then it will be fine cos prepareFromRequest was called too early that some how other widget has not been bound yet & that causing the problem. This should work in all browser.

String item="";  @Override  public void prepareFromRequest(PlaceRequest request){           super.prepareFromRequest(request);           item=request.getParameter("item", "");    }    @Override  public voi onReset{           super.onReset();           addToPopupSlot(loadingPresenter);           GetData action=new GetData(item);           dispatchAsync.execute(action, getDataCallback);  }  

On Thursday, January 23, 2014 7:03:32 PM UTC+11, Tom wrote:

I want to check the data at the time the page got loaded. I also want to put the loading indicator popup when checking data so that user will know that the page is loading data.

Look at this code:

@Override  public void prepareFromRequest(PlaceRequest request){           super.prepareFromRequest(request);           addToPopupSlot(loadingPresenter);           GetData action=new GetData();           dispatchAsync.execute(action, getDataCallback);  }  private AsyncCallback<GetDataResult> getDataCallback=new AsyncCallback<GetDataResult>(){          @Override          public void onFailure(Throwable caught) {              // TODO Auto-generated method stub              loadingPresenter.hide();          }            @Override          public void onSuccess(GetDataResult result) {              // TODO Auto-generated method stub              loadingPresenter.hide();                      //code to show data here          }  }  

OK, this code works fine in IE and in Firefox, but not ok in Chrome. That is:

In Chrome, after refreshing the page, the indicator did not hide though all data was showed correctly. In IE & Firefox the the indicator got hided properly.

I think there something wrong with Chrome somehow they can't call the loadingPresenter.hide();

What should I do? I don't think I should remove the loadingPresenter cos the getData method also was called when user clicking a button, so i need it to indicate the data is loading. But if i uses loadingPresenter then i can't run in Chrome.

So what should I do?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment