How to accurately remove elements from AsyncDataProvider ?

214 views
Skip to first unread message

Marius Grama

unread,
Nov 21, 2012, 9:12:17 AM11/21/12
to google-we...@googlegroups.com
Hi,

i am working with a CellTable backed by an AsyncDataProvider.

Can anybody tell how to solve the following two scenarios:
1. remove all elements from the cellTable
       I currently make asyncDataProvider.setRowCount(0,true);
    but this triggers onRangeChanged(HasData<XXX> display) on the asyncDataProvider causing a new asynchronous call which I'd like to avoid.

2. remove a specific element from the cellTable. Once a row gets selected and the user chooses to delete the entry, with a ListDataProvider I just had to remove the element from the list 
       listDataProvider.getList().remove(elementToBeDeleted);
backing the provider and the cellTable was refreshed.
With an AsyncDataProvider this possibility is not given and I am not sure how to deal with it.

Marius Grama

unread,
Nov 21, 2012, 11:19:51 AM11/21/12
to google-we...@googlegroups.com
For removing a specific element from the cellTable, I found in the meantime the following solution:

            cellTable.setVisibleRangeAndClearData(cellTable.getVisibleRange(), true);

This method call will generate a range change event, which will reload the data from the cellTable.
Reply all
Reply to author
Forward
0 new messages