Hi, i have added the add on below and created a grid like following code shows. The problem is, that the columns are duplicated. One time it uses them from the record and then my manually added ones. How can i prevent the addon from creating the columns automatically?
Flow Viritin | Vaadin Add-on Directory
public record OrderRecord(String id, String name, String orderdate) {
}
private void createGridPaginated() {
PagingGrid<OrderRecord> table = new PagingGrid<>(OrderRecord.class);
table.setPagingDataProvider((page, pageSize) -> {
int start = (int) (page * pageSize);
List<QuerySortOrder> sortOrders = new ArrayList<>();
if (!table.getSortOrder().isEmpty()) {
GridSortOrder<OrderRecord> sortOrder = table.getSortOrder().get(0);
String propertyId = sortOrder.getSorted().getKey();
boolean asc = sortOrder.getDirection() == SortDirection.ASCENDING;
sortOrders.add(new QuerySortOrder(propertyId, asc ? SortDirection.ASCENDING : SortDirection.DESCENDING));
}
return orderDataProvider.fetchFromBackEnd(new Query<>(start, pageSize, sortOrders, null, supplierId)).toList();
});
table.addThemeVariants(GridVariant.LUMO_ROW_STRIPES);
table.addColumn(OrderRecord::ip).setHeader("ID");
table.addColumn(OrderRecord::name).setHeader("Kundenname");
table.addColumn(OrderRecord::orderdate).setHeader("Bestelldatum");
table.setPaginationBarMode(PagingGrid.PaginationBarMode.BOTTOM);
table.setPageSize(25);
table.setTotalResults(orderDataProvider.getTotalSize(new Query<>(supplierId)));
add(table);
}
This is how it looks like: