How do people tend to let users re-order the grid columns and save that ordering for later?
The only way I can think of to do it, at least in Vaadin 7, is:
addColumnReorderListener(…)
getColumns()
and save to DB with any identifying informationsetColumnOrder(columns)
So is there a better way to do this? I just checked the Directory, could not find anything obvious to make this easier. Just looking for how others have addressed this user requirement. If Vaadin 14 already supports such actions a little easier, that would be good to know as well, as it might give me some ideas on how to get that ability short term before I can upgrade to Vaadin 14.
Just so people know how I solved this issue, based on the comments:
setColumnOrder(userColumns)
.We chose not to save the column order each time they changed the order, directly in the addColumnReorderListener
, because we realized sometimes users might move columns around temporarily, and one really want to save that column order for the future. That said, the saving inside the addColumnReorderListener
worked well.
We don't currently need to save the column sizes, as suggested by @Simon Martinelli, but we are keeping it as an idea for the future. I fully expect it would work.