Table columns not resized after making them visible

Hi,
I have an application where there is a table of which some of the columns can be made invisible (setVisibleColumns) by clicking a button.

When clicking the button, the columns disappear (so far, so good). However, the other columns (that are still visible) are not resized automatically to take in the space that was left by the columns that were made invisible. Only when resizing the browser window, the (visible) columns are redrawn and take in the complete width of the table.

Is there a way to make this the default behavior and not have to resize the browser window to make the columns take in the complete width of the table?

extract out of my code:

final Table tabUsersTable = new Table();
tabUsersTable.setWidth(“100%”);
tabUsersTable.setPageLength(8);
tabUsersTable.setTableFieldFactory(new UsersFieldFactory());
tabUsersTable.setContainerDataSource(getContainer());
tabUsersTable.setVisibleColumns(new Object{“Name”, “Full name”, “Group”});
addComponent(tabUsersTable);
final CheckBox switchEditable = new CheckBox(“Edit Users”);
switchEditable.addListener(new Property.ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
tabUsersTable.setEditable(((Boolean)event.getProperty()
.getValue()).booleanValue());
if(((Boolean)event.getProperty().getValue()).booleanValue()) {
tabUsersTable.setVisibleColumns(new Object{“Name”,
“Full name”, “Group”, “New password”, “Re-type new password”});
} else {
// when going back to the view with only 3 columns, they are not resized automatically to
// take in the space that was left by the ‘password’-columns that were made invisible
tabUsersTable.setVisibleColumns(new Object{“Name”,
“Full name”, “Group”});
}

        }
    });

Thanks,
Jan

Hi!

I think I have fixed this kind of bug just some weeks ago. Have you tried with nightlies (or the latest release 6.1.4) ?

cheers,
matti

I’ve recompiled my project with the latest version of Vaadin 6.1.4, but still see the same issue (columns not resizing after other ones are made invisible)…

Hi,
The problem seems fixed. I gave all of the columns (visible and non-visible) a width (some in expressed number of pixels, others using expandratio) and this seems to solve the problem.