Group table items using ltree
Hello guys. Do you know the best way to group table items for data array of object using ltree parameter. Basically I have a data array of following object => export const data: Race[] = [
{
id: "1",
name: "New York Marathon",
category: "runners",
},
{
id: "2",
name: "Race pro xyz",
category: "bike.mountain.pro",
},
{
id: "3",
name: "Race pro xyz",
category: "bike.mountain.pro",
},
{
id: "4",
name: "Bike race xyz",
category: "bike.road",
},
{
id: "5",
name: "Fun race",
category: "bike.road.hobbyist",
},
{
id: "6",
name: "Fun mountain",
category: "bike.montain.hobbyist",
},
];
And I would like to group the table like
bike -> mountain -> pro -> list of races
bike -> road -> hobbyist -> list of races
bike -> road -> list of races ...
Thanks for your help.
0 Replies