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.