TanStackT
TanStack2y ago
4 replies
then-purple

How to filter by items and subItems

My data model is:
{
"id": 1,
"name": "Pilot",
"site_url": "products/pilot",
"search_keywords": "pilot",
"model": "Pilot",
"brand": "BrandX",
"price": 69,
"popularity": null,
"category": "BrandX",
"category_id": 36,
"status": "published"
}

Product has category and subcategory, for example "Pilot" is an "Airplane" and it is of "BrandX" categories. How should i change data from backend and and how can i have search in filter by all categories and subcategories. So that in cell of the category, i have the last (end) category of the brand, but if i search by Airplane, it will show me all products with that main category.

In filter, for that field, i want select to look like:
Airplane
--brandX
--brandY
Sofa
--brandX
--brandY

And be able to filter by category and subcategory

Is it even possible with tanstack table?
image.png
image.png
Was this page helpful?