How to expand all rows by default? #2134
-
|
HI, Codesandbox Link: |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
|
just add the following: |
Beta Was this translation helpful? Give feedback.
-
|
Please don't use an effect to achieve this. Simply set expanded to true when creating your useState for the expanding. const [expanded, setExpanded] = useState<ExpandedState>(true); |
Beta Was this translation helpful? Give feedback.
-
|
If tanstack table controls the state: const table = useReactTable({
…
initialState: { expanded: true },
getExpandedRowModel: getExpandedRowModel(),
}); |
Beta Was this translation helpful? Give feedback.
just add the following:
useEffect(() => { toggleAllRowsExpanded(); }, []);