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?


3 Replies
fascinating-indigoOP•17mo ago
<>
<datalist id={column.id + 'list'}>
{sortedUniqueValues.slice(0, 5000).map((value: any) => (
<>
<option
key={value?.subcategories ? value?.title : value}
value={value?.subcategories ? value?.title : value}
/>
{value?.subcategories?.map((subValue: any) => (
<option
key={subValue}
value={subValue}
/>
))}
</>
))}
</datalist>
</>
fascinating-indigoOP•17mo ago

fascinating-indigoOP•17mo ago
Now i try to add subcategories to a category
But how do i filter in onChange