Grid with list count property column

Drag a column header and drop it here to group by that column
Id
Person
Food
MealsCount
Meals
Location
3675MaryfoodShepherd's pie2Wheat, PapayaDiner
3671JeremyfoodPizza1HazelnutsTavern
3667JohnfoodCheesecake2Walnuts, BroccoliRestaurant
3663MichaelfoodHot Beverage2Potato, BroccoliVisit
3659GabriellefoodFrench toast2Papaya, TomatoTavern
3655LucyfoodBig Salad3Broccoli, Banana, TomatoTavern
3651CheyennefoodBig Salad1RiceVisit
3647JonahfoodShepherd's pie3Oats, Banana, PapayaVisit
3643FernandofoodSoup1RiceUniversity
3639AudreyfoodShepherd's pie1RiceUniversity

In this demo we show how you can have a count property in the grid, while also being able to sort and group by that property.
For this to work you need to add a get only property to your Entity (Lunch in our case public int MealsCount => Meals.Count();), after this you can use the count property as any other property.
However if you're using EntityFramework you'll also need to set the OrderByFunc on the GridModelBuilder.



Comments