Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/Composite.html#initWidget%28com.google.gwt.user.client.ui.Widget%29" rel="nofollow"><code>initWidget(Widget widget)</code></a> is a method of the <a href="http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/Composite.html" rel="nofollow"><code>Composite</code></a> class used to initialize itself as a wrapper for a possible inner aggregation of widgets. Generally you create a composition of widgets rooted on a given widget and then pass it to the <code>initiWidget()</code> method. This way, the rooted element is not exposed (in terms of its methods) but still acts as if it was never wrapped.</p> <p>In your sample you have <code>UiBinder</code> takes care of defining the UI, so you pass to such method the return of the binding creation (<code>uiBinder.createAndBindUi(this)</code>). Before this call (actually, before the <code>createAndBindUi()</code>, but generally it is tied to the <code>initWidget()</code>), you <em>must</em> instantiate all your widget marked with <code>@UiField(provided = true)</code> i.e., all those who need a proper initialization otherwise impossible in plain <code>UiBinder</code> style. In your case, you don't need to mark everything <code>provided = true</code>, only the <code>CellTable</code> requires that (for the specialization).</p> <p>Back to your problem, if you remove the <code>configureDataProvider()</code> call, you will never set up the <code>AsyncDataProvider</code> and simply you will see no data at all (the spinning gif is because somewhere - can't remember where now - the row count has been set to 0). If you enable it, the call to <code>addDataDisplay()</code> will implicitly force a range update that will end up calling the <code>AsyncDataProvider</code> to request your data.</p> <p>The problem is that you do not update both the row data <em>and</em> the row count at the same time in the <code>onSuccess()</code> callback. See <a href="http://turbomanage.wordpress.com/2011/03/02/gwt-2-2-asyncdataprovider-celltable-gotcha/" rel="nofollow">here</a>.</p> <p>Also, you don't need to call <code>updateRowCount()</code> after <code>addDataDisplay()</code>, otherwise two requests will be made to retrieve the same initial data, which is unnecessary.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload