I am using ItemChangeListener to retrieve on single click in data grid but is there a workaround to move the selected row cursor using keyboard keys because it takes too many clicks to move from row to row.
I have a split screen with two data grid’s, the row selection on the above data grid shows the related results in the lower grid. (related topic: Update column based on row selection - CUBA.Platform)
Everything works fine as it retrieve on single clicks but I also want to control the row selection by keyboard to work along with the same functionality.
`// ItemChangeListener to retrieve on single click
annotationsDs.addItemChangeListener(event -> {
annotationFieldVar = AnnotationFieldDataGrid.getSingleSelected();
if(annotationFieldVar!= null){
aliasDataGrid.setVisible(true); // set visibility back to true on annotation selection
aliasesDs.setQuery("select e from zeusv2$Alias e where e.annotation.id='" + annotationFieldVar.getId() + "\'");
aliasesDs.refresh();
}
});`
(b) With selection listener:
'AnnotationFieldDataGrid.addSelectionListener(e -> {
annotationFieldVar = AnnotationFieldDataGrid.getSingleSelected();
if(annotationFieldVar!= null){
aliasDataGrid.setVisible(true); // set visibility back to true on annotation selection
aliasesDs.setQuery("select e from zeusv2$Alias e where e.annotation.id='" + annotationFieldVar.getId() + "\'");
aliasesDs.refresh();
}
});
So, I suppose that you use keyboard arrows and selection isn’t changed? If so, that is not an issue, due to DataGrid default behavior. You have to press Space Bar to trigger row selection.