Search code examples
vaadintablecolumn

Add new table column that's left aligned in table


We're developing a web application using the Vaadin framework.

In this app I have an existing table with a range a columns. On a user action I want to remove some of the existing columns and add some other additional columns.

This proved quite easy, however, I want the added column to be placed as the first column in the table, on the out most left edge of the table, and I can't seem to find any support for this action. Every column that's added is by default placed as the last column, in the out most right of the table.


Solution

  • What you should do is to set your

    table.setVisibleColumns(your sorted order of columns)
    

    and also

    table.setColumnReorderingAllowed(false) 
    

    it might be good to throw in a force of relaoding the datasource so

    table.setContainerDataSource(table.getContainerDataSource());