Description
setColumnOrder not working if done inside a button click.
It works only if it has been called before.
It works in 24.9.13 but not in 25.1.1
Expected outcome
It should work irrespective of whether setColumnOrder has been worked before or not
Minimal reproducible example
record Element(String name) {
}
@Route("grid-col-order")
class GridColumnOrder extends VerticalLayout {
final Grid<Element> taskGrid;
GridColumnOrder() {
taskGrid = new Grid<>();
var list = new ArrayList<Element>();
list.add(new Element("Foo"));
list.add(new Element("Bar"));
var listProvider = new ListDataProvider<>(list);
taskGrid.setDataProvider(listProvider);
var firstColumn = taskGrid.addColumn(Element::name).setHeader("First Column");
var secondColumn = taskGrid.addColumn(element -> "Second Column").setHeader("Second");
var thirdColumn = taskGrid.addColumn(element -> "Third Column").setHeader("Third");
//Uncomment the below code to check the difference in behaviour
//var columnList1 = new ArrayList<Grid.Column<Element>>();
//columnList1.add(secondColumn);
//columnList1.add(firstColumn);
//columnList1.add(thirdColumn);
//taskGrid.setColumnOrder(columnList1);
taskGrid.setColumnReorderingAllowed(true);
var resetButton = new Button("Reset Order");
resetButton.addClickListener(event -> {
var columnList = new ArrayList<Grid.Column<Element>>();
columnList.add(firstColumn);
columnList.add(secondColumn);
columnList.add(thirdColumn);
taskGrid.setColumnOrder(columnList);
});
add(resetButton);
setSizeFull();
add(taskGrid);
}
}
Steps to reproduce
- Add the code to a 25.1.1 sample
- Change the column order
- Click the button to check the reorder does not happen
- Uncomment the commented lines
- Change the column order
- Click the button to check that the reorder happens
Environment
Vaadin version(s): 25.1.1
Browsers
No response
Description
setColumnOrder not working if done inside a button click.
It works only if it has been called before.
It works in 24.9.13 but not in 25.1.1
Expected outcome
It should work irrespective of whether setColumnOrder has been worked before or not
Minimal reproducible example
Steps to reproduce
Environment
Vaadin version(s): 25.1.1
Browsers
No response