From e1782700e23664912d0e20cf5111965dcdfa9e57 Mon Sep 17 00:00:00 2001 From: filippo-ferrari Date: Tue, 11 Jun 2024 21:47:31 +0200 Subject: [PATCH] feat: Sorting sorting for name, cost, date and category --- .../application/munera/views/expenses/ExpensesView.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/application/munera/views/expenses/ExpensesView.java b/src/main/java/com/application/munera/views/expenses/ExpensesView.java index 8f6c1ee..d621ac6 100644 --- a/src/main/java/com/application/munera/views/expenses/ExpensesView.java +++ b/src/main/java/com/application/munera/views/expenses/ExpensesView.java @@ -85,12 +85,12 @@ public class ExpensesView extends Div implements BeforeEnterObserver { add(splitLayout); // Configure Grid - grid.addColumn(Expense::getName).setHeader("Name").setSortable(true); - grid.addColumn(Expense::getCost).setHeader("Amount").setSortable(true); - grid.addColumn(expenseCategory -> expenseCategory.getCategory().getName()).setHeader("Category").setSortable(true); + grid.addColumn(Expense::getName).setHeader("Name").setSortable(true).setSortProperty("name"); + grid.addColumn(Expense::getCost).setHeader("Amount").setSortable(true).setSortProperty("cost"); + grid.addColumn(expenseCategory -> expenseCategory.getCategory().getName()).setHeader("Category").setSortable(true).setSortProperty("category"); grid.addColumn(Expense::getPeriodInterval).setHeader("Period Interval").setSortable(true); grid.addColumn(Expense::getPeriodUnit).setHeader("Period Unit").setSortable(true); - grid.addColumn(Expense::getDate).setHeader("Date").setSortable(true); + grid.addColumn(Expense::getDate).setHeader("Date").setSortable(true).setSortProperty("date"); grid.getColumns().forEach(col -> col.setAutoWidth(true)); grid.setItems(query -> expenseService.list(