T
TanStack•2y ago
correct-apricot

How to get a result for subRows search in a table

I have only 2 columns. I can see the result of the search in a search component (in filter), but when i press on it, the results are not showing up in the table
No description
No description
6 Replies
sensitive-blue
sensitive-blue•2y ago
I think adding filterFromLeafRows: true to your table instance should work
correct-apricot
correct-apricotOP•2y ago
Thank you so much! maybe you know, how can i hide main categories? type ColumnResultCategories = { id: number; parent_id: null; name: string; subcategories: { id?: number; parent_id?: number; name?: string; }[]; } I need checkbox to show only subcategories, how could i do that
sensitive-blue
sensitive-blue•2y ago
Hiding the main categories when filtering from leaf rows I don't know,I have that exact question myself actually 😅 I'm not sure where you render the checkbox, but if you're calling it based on row.isSelectable you can put enableRowSelection: (row)=> with a function to determine wether or not that row should be selectable in your table instance
correct-apricot
correct-apricotOP•2y ago
No, i mean how would you do "hiding main categories" just from ui. If it is placed just above the table. I press checkbox and i call table.toggleAllRowsExpanded() BUT i need to do something to hide main categories. So only subcategories are shown all expanded. Is it even possible to show subcategories, hiding its parent? Thank you for answering, man!
sensitive-blue
sensitive-blue•2y ago
Np! I'm not even close to good at react table yet but I've been through these lol >So only subcategories are shown all expanded. Is it even possible to show subcategories, hiding its parent? I haven't found a way! I'm also keen on it. I'm kind of assuming the answer is no since it feels like the table asks you who the first class citizens are, the children or the parents, but I'm really not sure!
correct-apricot
correct-apricotOP•2y ago
How do we summon a tanstack table developers here to answer?

Did you find this page helpful?