Reputation: 249
I am getting this error when I try to sort the grid programmatically:
grid.sort(List.of(
new GridSortOrder<>(grid.getColumnByKey("Νο"), SortDirection.ASCENDING),
new GridSortOrder<>(grid.getColumnByKey("επίθετο"), SortDirection.ASCENDING)
));
The error:
Cannot invoke "com.vaadin.flow.component.grid.Grid$Column.getInternalId()" because the return value of "com.vaadin.flow.component.grid.GridSortOrder.getSorted()" is null
Is it because I use Greek characters in Grid
columns? Do you know any solution or workaround?
Upvotes: 1
Views: 443
Reputation: 201
In order to call grid.getColumnByKey()
you need to set the key for each column. This works okay:
final String COL1 = "Νο";
final String COL2 = "επίθετο";
Grid<SomeBean> grid = new Grid<>();
grid.addColumn(SomeBean::getId).setHeader("Column 1").setKey(COL1);
grid.addColumn(SomeBean::getName).setHeader("Column 2").setKey(COL2);
grid.sort(List.of(
new GridSortOrder<>(grid.getColumnByKey(COL1), SortDirection.ASCENDING),
new GridSortOrder<>(grid.getColumnByKey(COL2), SortDirection.ASCENDING)
));
Upvotes: 4