tags:

views:

28

answers:

1

I'm using a CellTable from GWT 2.1.0.M3. There are removeColumn functions, but no removeAllColumns or anything. Since "columns" is a private member of CellTable, not even my extension of CellTable can easily access it.

For now, I'm just storing the number of columns I add so I can remember to remove them all. Anyone know a better way?

A: 

This might not be what your looking for but it works for me:

getCellTable().setVisibleRange(0, 0);
listViewAdapter.updateRowData(0, result);
getCellTable().setVisibleRange(0, 10);
nick
Does this remove columns as well? My columns change when the row data changes, so I need to remove them all and add new ones.
Riley
I have not encountered that situation; probably not. Is your current solution of removing the columns one by one currently working?
nick
I was in the same situation when using the DropDownListBox (from the incubator)...There is no clear() or removeAll() method, so when using it with UiBinder a similar problem arouse. I ended up creating a flowPanel using UiBinder and adding the DropDownListBox into it using Java code. Then i could clear the flowPanel and add a new DropDownListBox when i needed to clear the items. This would work in your case also, but it seems the solution you have is better.
nick
Yeah, I'd rather keep the widget directly in the UiBinder xml code so that it can be styled easily. And yes, removing the columns one-by-one is currently working, but it has me scared that some API change will come along and break it. Thanks for the comments!
Riley