i try to implement navigation with key arrow in the grid.
to do this i need to able select one row per row index programmatically.
How can i do this?
thx.
i try to implement navigation with key arrow in the grid.
to do this i need to able select one row per row index programmatically.
How can i do this?
thx.
Vaadin Flow Grid has method Grid.select(item), which selects item programmatically. So you need to resolve the item. The best way to get it, is to use Grid.getDataCommunicator() which has the following method, fetchFromProvider:
So fetchFromProvider(rowIndex,1) returns the item you want to select.
You can use the defined SelectionModel of your grid.
private Grid<Customer> customerGrid = new Grid<>();
customerGrid.getSelectionModel().select([enter your logic for identifying the customer of your wish]);
Use the following API (since Vaadin 17)
Person item = grid.getDataCommunicator().getItem(42);
grid.select(item);
or
Person item = grid.getGenericDataView().getItem(42);
grid.select(item);