Problem with default sort order in grid


We are using Vaadin 14.1.5.

We have got a grid and want to sort the second column by default:

We wrote following code:

                final com.vaadin.flow.component.grid.Grid.Column                                                                          column0 = grid
                final java.util.ArrayList<com.vaadin.flow.component.grid.GridSortOrder<>> sort    = new java.util.ArrayList<com.vaadin.flow.component.grid.GridSortOrder<>>();
                final com.vaadin.flow.component.grid.GridSortOrder<>                      order   = new com.vaadin.flow.component.grid.GridSortOrder<>(

All is fine. The grid sorts header of second colum is marked blue and the right sort arrow is highlighted.

But there is a problem: Whe we click on anonther column header to sort this one we have got to click twice.

After the second click sorting goes on.

Why we have got to click two times?

Thank you very much,

Tested (and used) your code to sort our grid and it works fine with the latest Vaadin 14.1.25. First click on another column header sorts that column ASC, second click sorts DESC. Haven’t tested with any previous version.

ArrayList<GridSortOrder<XXXDetails>> sort = new java.util.ArrayList<>();
GridSortOrder<XXXDetails> order = new GridSortOrder<>(xxxDetailsGrid.getColumns().get(0),;