Then, using addDataChangedHandler, I stream through the results and select the related records.
This method solves the issue of only selecting records that are listed in the grid as well.
Code:
grid.addDataChangedHandler(event -> grid.selectRecords(Arrays.stream(grid.getRecords()).filter(listGridRecord -> MAP.containsKey(listGridRecord.getAttributeAsLong(PRIMARY_KEY))).toArray(Record[]::new)));
Leave a comment: