How to hide a column in the GWT DataGrid Widget

881 views
Skip to first unread message

Bill M

unread,
Mar 7, 2012, 3:06:46 PM3/7/12
to Google Web Toolkit
Hi,

Is there a way to hide a column in the GWT DataGrid widget? I was
using someone's suggestion of setting the columnWidth of the column I
want to hide to 0. However, with that approach the String data seems
to be "wrapping" in the hidden column, causing some rows to have a
larger height.

Is there another way to hide a column? Or, do I need to implement my
own data structure to handle this?

Thanks,
Bill M

Patrick Tucker

unread,
Mar 8, 2012, 10:38:44 AM3/8/12
to Google Web Toolkit
Maybe try setting the columns value to empty when the width is 0?

Something like this?
Column<...> itemColumn = new Column<...>(new TheCell()) {
@Override
public Object getValue (Object object) {
if (theDataGrid.getColumnWidth(this) == 0) {
return "";
}

return object.toString();
}
};
Reply all
Reply to author
Forward
0 new messages