The initWidget(Widget widget)
is a method of the Composite
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 initiWidget()
method. This way, the rooted element is not exposed (in terms of its methods) but still acts as if it was never wrapped.
In your sample you have UiBinder
takes care of defining the UI, so you pass to such method the return of the binding creation (uiBinder.createAndBindUi(this)
). Before this call (actually, before the createAndBindUi()
, but generally it is tied to the initWidget()
), you must instantiate all your widget marked with @UiField(provided = true)
i.e., all those who need a proper initialization otherwise impossible in plain UiBinder
style. In your case, you don't need to mark everything provided = true
, only the CellTable
requires that (for the specialization).
Back to your problem, if you remove the configureDataProvider()
call, you will never set up the AsyncDataProvider
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 addDataDisplay()
will implicitly force a range update that will end up calling the AsyncDataProvider
to request your data.
The problem is that you do not update both the row data and the row count at the same time in the onSuccess()
callback. See here.
Also, you don't need to call updateRowCount()
after addDataDisplay()
, otherwise two requests will be made to retrieve the same initial data, which is unnecessary.