Bug Report: table.getRowModel().rows
returns only 10 rows when depth is 1
#5955
Replies: 1 comment
-
Update: Issue Resolved 🎉I found the mistake! I was missing the pagination state, which caused only 10 items to be rendered by default. Solution:Setting the pagination state correctly ensures that all rows are displayed: const pagination = useMemo(() => {
return {
pageIndex: 0,
pageSize: data.map((d) => d.subRows?.length ?? 0).reduce((acc, val) => acc + val, 0) + data.length,
};
}, [data]);
const table = useReactTable({
data,
columns,
enableRowSelection: true,
state: {
pagination,
},
getRowId: (row) => row.id,
columnResizeMode: 'onChange',
getSubRows: (row) => row.subRows,
getCoreRowModel: getCoreRowModel(),
getExpandedRowModel: getExpandedRowModel(),
getPaginationRowModel: getPaginationRowModel(),
}); |
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
-
Bug Report:
table.getRowModel().rows
returns only 10 rows when depth is 1Description
When using
table.getRowModel().rows
, the returned array contains a maximum of 10 rows if the row depth is 1. However,table.getRowModel().rowsById
returns the correct number of rows.Steps to Reproduce
table.getRowModel().rows
.table.getRowModel().rowsById
and compare the results.Expected Behavior
table.getRowModel().rows
should return all rows, not just a maximum of 10, similar totable.getRowModel().rowsById
.Actual Behavior
Only 10 rows are returned when using
table.getRowModel().rows
, whiletable.getRowModel().rowsById
returns the full set.Environment
Additional Context
It seems that
table.getRowModel().rows
might be applying an unintended limit when the row depth is 1.Beta Was this translation helpful? Give feedback.
All reactions