Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read properties of undefined (reading 'rows') #5098

Open
2 tasks done
ghost opened this issue Sep 27, 2023 · 3 comments
Open
2 tasks done

Cannot read properties of undefined (reading 'rows') #5098

ghost opened this issue Sep 27, 2023 · 3 comments

Comments

@ghost
Copy link

ghost commented Sep 27, 2023

Describe the bug

Cannot read properties of undefined (reading 'rows') with basic example on github

const defaultData = [
{
firstName: "tanner",
lastName: "linsley",
age: 24,
visits: 100,
status: "In Relationship",
progress: 50,
},
{
firstName: "tandy",
lastName: "miller",
age: 40,
visits: 40,
status: "Single",
progress: 80,
},
{
firstName: "joe",
lastName: "dirte",
age: 45,
visits: 20,
status: "Complicated",
progress: 10,
},
];

const columns = [
columnHelper.accessor("firstName", {
cell: (info) => info.getValue(),
footer: (info) => info.column.id,
}),
columnHelper.accessor((row) => row.lastName, {
id: "lastName",
cell: (info) => {info.getValue()},
header: () => Last Name,
footer: (info) => info.column.id,
}),
columnHelper.accessor("age", {
header: () => "Age",
cell: (info) => info.renderValue(),
footer: (info) => info.column.id,
}),
columnHelper.accessor("visits", {
header: () => Visits,
footer: (info) => info.column.id,
}),
columnHelper.accessor("status", {
header: "Status",
footer: (info) => info.column.id,
}),
columnHelper.accessor("progress", {
header: "Profile Progress",
footer: (info) => info.column.id,
}),
];

const table = useReactTable({
defaultData,
columns,
state: {
columnPinning,
},
getCoreRowModel: getCoreRowModel(),
});

{table.getHeaderGroups().map((headerGroup) => ( {headerGroup.headers.map((header) => ( ))} ))} {table.getRowModel().rows.map((row) => ( {row.getVisibleCells().map((cell) => ( ))} ))}
{header.isPlaceholder ? null : flexRender( header.column.columnDef.header, header.getContext() )}
{flexRender( cell.column.columnDef.cell, cell.getContext() )}

Your minimal, reproducible example

local

Steps to reproduce

Basic example

Expected behavior

Work

How often does this bug happen?

None

Screenshots or Videos

No response

Platform

Windows latest Edge Chromium

react-table version

8.10.3

TypeScript version

No response

Additional context

No response

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
@nick-tw
Copy link

nick-tw commented Oct 22, 2023

you have

const table = useReactTable({ defaultData, columns, state: { columnPinning, }

try this instead:
const table = useReactTable({ data:defaultData, columns, state: { columnPinning, },

@yannicksaenen
Copy link

I have the same issue, did you find a solution?

@uppuluriaditya
Copy link

I have faced the same issue earlier and answer by nick-tw worked. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants