I have a very similar problem. I have a DataGrid and when I load data from
an RPC I want to show the loading indicator on the grid and when the data
are loaded I wanted to show them. I initialize the datagrid with;
myDataGrid.setLoadingIndicator(new Image(/*my ImageResource object*/);
then during the program flow, just before making an async RPC, I would like to
set the DataGrid in the state of 'Loading'
so that the loading indicator is shown. Then, after the RPC returns I would
like to set the DataGrid in the state of 'Loaded'
to show the data rows. I tried with this:
....
myDataGrid.fireEvent(new LoadingStateChangeEvent(LoadingState.LOADING));
....
myDataGrid.fireEvent(new LoadingStateChangeEvent(LoadingState.LOADED));
but nothing happens.
I have also tried to call setVisibleRangeAndClearData but it doesn't work.
I read from Thomas Broyer that "the loading indicator is shown only when
the LoadingState is LOADING, and that one is set by the internal
HasDataPresenter only when the known rowData is empty (and the rowCount is
not 0)." What exactly does it mean? What is the 'known' rowData? I use a
ListDataProvider to bind data to the DataGrid. Where am I wrong? What is
the right way to set the 'Loading' state of the DataGrid?
jgm: does you code did the trick? I think anyway it's just a little too
tricky. I think that considering how the DataGrid (and CellTable also) is
designed, I really think and hope there is a simple way. The support for
this is not really good. I think google should explain better how to use
these controls.
Cheers.
On Wednesday, February 1, 2012 3:26:10 PM UTC+1, jgm wrote:
>
> Hi,
>
> Thanks for your quick answer.
>
> We also in the meantime found out that ..
>
> private void clearTable() {
> if (dataProvider.getDataDisplays() != null &&
> dataProvider.getDataDisplays().isEmpty() == false) {
> dataProvider.removeDataDisplay(cellTable);
> }
>
> clearTableColumns();
>
> cellTable.setVisibleRangeAndClearData(cellTable.getVisibleRange(),
>
> true);
> cellTable.setLoadingIndicator(imageProcessing);
> }
>
> did the trick !
>
> On 1 Feb., 14:44, Thomas Broyer <[email protected]> wrote:
> > AFAICT, CellTable shows the loading indicator only when the LoadingState
> is
> > LOADING, and that one is set by the internal HasDataPresenter only when
> the
> > known rowData is empty (and the rowCount is not 0). So I think you need
> to
> > call setVisibleRangeAndClearData().
On Wednesday, February 1, 2012 3:26:10 PM UTC+1, jgm wrote:
>
> Hi,
>
> Thanks for your quick answer.
>
> We also in the meantime found out that ..
>
> private void clearTable() {
> if (dataProvider.getDataDisplays() != null &&
> dataProvider.getDataDisplays().isEmpty() == false) {
> dataProvider.removeDataDisplay(cellTable);
> }
>
> clearTableColumns();
>
> cellTable.setVisibleRangeAndClearData(cellTable.getVisibleRange(),
>
> true);
> cellTable.setLoadingIndicator(imageProcessing);
> }
>
> did the trick !
>
> On 1 Feb., 14:44, Thomas Broyer <[email protected]> wrote:
> > AFAICT, CellTable shows the loading indicator only when the LoadingState
> is
> > LOADING, and that one is set by the internal HasDataPresenter only when
> the
> > known rowData is empty (and the rowCount is not 0). So I think you need
> to
> > call setVisibleRangeAndClearData().
On Wednesday, February 1, 2012 3:26:10 PM UTC+1, jgm wrote:
>
> Hi,
>
> Thanks for your quick answer.
>
> We also in the meantime found out that ..
>
> private void clearTable() {
> if (dataProvider.getDataDisplays() != null &&
> dataProvider.getDataDisplays().isEmpty() == false) {
> dataProvider.removeDataDisplay(cellTable);
> }
>
> clearTableColumns();
>
> cellTable.setVisibleRangeAndClearData(cellTable.getVisibleRange(),
>
> true);
> cellTable.setLoadingIndicator(imageProcessing);
> }
>
> did the trick !
>
> On 1 Feb., 14:44, Thomas Broyer <[email protected]> wrote:
> > AFAICT, CellTable shows the loading indicator only when the LoadingState
> is
> > LOADING, and that one is set by the internal HasDataPresenter only when
> the
> > known rowData is empty (and the rowCount is not 0). So I think you need
> to
> > call setVisibleRangeAndClearData().
On Wednesday, February 1, 2012 3:26:10 PM UTC+1, jgm wrote:
>
> Hi,
>
> Thanks for your quick answer.
>
> We also in the meantime found out that ..
>
> private void clearTable() {
> if (dataProvider.getDataDisplays() != null &&
> dataProvider.getDataDisplays().isEmpty() == false) {
> dataProvider.removeDataDisplay(cellTable);
> }
>
> clearTableColumns();
>
> cellTable.setVisibleRangeAndClearData(cellTable.getVisibleRange(),
>
> true);
> cellTable.setLoadingIndicator(imageProcessing);
> }
>
> did the trick !
>
> On 1 Feb., 14:44, Thomas Broyer <[email protected]> wrote:
> > AFAICT, CellTable shows the loading indicator only when the LoadingState
> is
> > LOADING, and that one is set by the internal HasDataPresenter only when
> the
> > known rowData is empty (and the rowCount is not 0). So I think you need
> to
> > call setVisibleRangeAndClearData().
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/jymmqDUjO4cJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.