reload celltable data

851 views
Skip to first unread message

jgm

unread,
Feb 1, 2012, 8:27:41 AM2/1/12
to Google Web Toolkit
Hi,

We are using a celltable with a ListDataProvider. The celltable is
defined via UiBinder.
When loading new data, the loadingindicator is not shown and the
celtable is not cleared.

When loading new data, we would like to reset the celltable and
dataprovider, something like this:

if (dataProvider.getDataDisplays() != null &&
dataProvider.getDataDisplays().isEmpty() == false) {
dataProvider.getList().clear();
dataProvider.removeDataDisplay(cellTable);
dataProvider.refresh();
cellTable.redraw();
}
cellTable.setLoadingIndicator(imageProcessing);

But it doesn't work!

Does anyone know how to reload data into a celltable and having the
loadingindicator shown again while the data is loaded ?

Thomas Broyer

unread,
Feb 1, 2012, 8:44:25 AM2/1/12
to google-we...@googlegroups.com
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().

jgm

unread,
Feb 1, 2012, 9:26:10 AM2/1/12
to Google Web Toolkit
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 !

Magallo

unread,
Mar 2, 2012, 4:10:13 AM3/2/12
to google-we...@googlegroups.com
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.

Magallo

unread,
Mar 5, 2012, 11:23:34 AM3/5/12
to google-we...@googlegroups.com

develop.acb

unread,
Mar 20, 2012, 10:20:57 AM3/20/12
to google-we...@googlegroups.com

Hello,
we have similar problems with CellTable and DataGrid. I can´t find a solution getting the loading indicator to work!
Is there anybody who
could provide somthing like "How to use loading indicator"?

Thanks...

Magallo

unread,
Apr 17, 2012, 7:09:45 AM4/17/12
to google-we...@googlegroups.com
Just to quote U2....I still haven't found what I'm looking for...... For now I just use a custom label with the "loading..." text instead of a loading indicator. I know it's not the right solution but it's a workaround that helps waiting for the right solution.

Tibor Mucha

unread,
Dec 15, 2015, 6:25:18 AM12/15/15
to GWT Users
cellTable.setVisibleRangeAndClearData(new Range(0, 9999), false);
Reply all
Reply to author
Forward
0 new messages