platform
platform copied to clipboard
draggable grid column is not draggable anymore after invoking grid.setVisible()
Describe the bug
Let's assume we have a Grid instance with:
grid.setRowsDraggable(true)
All columns of the grid are then - as expected - draggable.
Now hide a column by invoking:
grid.getColumnByKey("myColumn").setVisible(false);
The column is now hidden - ok.
Now make the column visible again:
grid.getColumnByKey("myColumn").setVisible(true);
The column is now visible again - but it is not draggable anymore.
The HTML attribute draggable="true" of the related vaadin-grid-cell-content tag is gone.
This was not an issue with Vaadin 20.0.6
Note: with
grid.getColumnByKey("myColumn").setVisible(true);
UI.getCurrent().push();
grid.setRowsDraggable(true);
grid.getDataProvider().refreshAll()
it is working. But I guess this is not the way it is intended.
Expected-behavior
After invoking setVisible(false) and later setVisible(true) on a draggable grid column the column should still be draggable
Reproduction
build up a grid with at least one column and make the rows draggable with
grid.setRowsDraggable(true);
Now use something to toggle the visibility of a column of this grid, e.g. a simple button:
Button button = new Button(); AtomicBoolean isVisible = new AtomicBoolean(true); button.addClickListener(cel -> { grid.getColumnByKey("myDraggableColumn").setVisible(isVisible.get()); isVisible.set(!isVisible.get()); });
System Info
Windows 10, Chrome, Edge, Vaadin 22.0.4