Expanding rows on filtering #1159
-
How do I automatically expand the tree structure when searching if the desired value is inside a child value? Now we have to manually open the structure... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found a solution! ` useEffect(() => {
}, [table.getState().globalFilter])` ! in the in the |
Beta Was this translation helpful? Give feedback.
I found a solution!
` useEffect(() => {
const expandedRows = table.getRowModel().rows.map(row => row.id)
}, [table.getState().globalFilter])`
! in the
IF
condition, we hide the nested table elements (in my case, the main parent element of the table is revealed) when we clear the search (global filter).in the
ELSE
condition, we expand the table when we search for something in the search (global filter).