Vaadin 8 grid change column order

I create grid with columns. See photos attached. But in some cases it must start with Friday, Saturday…, in other cases Monday, Tuesday etc.
Give me advice how to implemented it.


There is method Grid#setColumnOrder() for this. You need to either have Column references or ids there. You can set them when building the Grid.

One other straightforward way could be that you use Grid with class parameter, so that it picks the property names. I.e. Grid<Bean> grid = Grid<>(Bean.class, false); After that you can call grid.setColumns("friday","saturday", ...) or grid.setColumns("monday","tuesday", ...)

But I have another columns no to be altered. But after code changes order of columns changes too.

. But after code changes order of columns changes too.

You naturally need to have the invariant columns in setColumns too, e.g. grid.setColumns("week","exhibitor","site","movie","friday","saturday", ...) or grid.setColumns("week","exhibitor","site","movie","monday","tuesday", ...)