question: expanded groups by default #248
-
I need all rows of the grouped table be expanded by default. type D = { firstname: string; lastname: string; lang: string };
const columns: Column<D>[] = useMemo(
() => [
{ accessor: 'firstname', Header: 'First Name' },
{ accessor: 'lastname', Header: 'Last Name' },
{ accessor: 'lang', Header: 'Language' },
],
[],
);
const data: D[] = useMemo(
() => [
{ firstname: 'Dan', lastname: 'AB', lang: 'js' },
{ firstname: 'Bob', lastname: 'XY', lang: 'js' },
{ firstname: 'Linus', lastname: 'Tr', lang: 'c' },
],
[],
);
const groupBy = useMemo(() => ['lang'], []);
const table = useTable(
{
columns,
data,
initialState: { groupBy },
},
useGroupBy,
useExpanded,
); |
Beta Was this translation helpful? Give feedback.
Answered by
cherniavskii
Mar 17, 2020
Replies: 3 comments
-
the link in https://github.com/tannerlinsley/react-table is not correct. |
Beta Was this translation helpful? Give feedback.
0 replies
-
That's react-query project, not react-table |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
tannerlinsley
-
the link in react-table was wrong, now it fixed |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's react-query project, not react-table