Hello,
how can I use these component in a Grid Cell? Do you have a code example?
Thank you for your answer.
Hello,
how can I use these component in a Grid Cell? Do you have a code example?
Thank you for your answer.
Hello,
as far as I know targeting the cell itself is not possible, but you can target any component inside it:
private void demoGrid() {
Tooltips tt = Tooltips.getCurrent();
List<GridData> data = new ArrayList<>();
for(int i=0; i<999; i++) {
int ranom = new Random().nextInt(i+1);
data.add(new GridData("key " + i, String.valueOf(ranom)));
}
ListDataProvider<GridData> dataProvider = new ListDataProvider<>(data);
Grid<GridData> grid = new Grid<>();
grid.removeAllColumns();
grid.addComponentColumn(entry -> {
Span key = new Span(entry.getKey());
tt.setTooltip(key, "Tooltip of " + key.getText());
return key;
}).setHeader("Key");
grid.addColumn(GridData::getRandom).setHeader("Value");
grid.setDataProvider(dataProvider);
add(grid);
}
@Data
private static class GridData {
private final String key;
private final String random;
}
But I need to add that grid content previously caused issues (sometimes the tooltip does get registered properly).
Best Regards
Gerrit