Checkbox from "enableRowSelection" wont change status
MatteoDfactorySrl opened this issue · 0 comments
MatteoDfactorySrl commented
material-react-table version
v2.12.1
react & react-dom versions
v18.2.0
Describe the bug and the steps to reproduce it
In my react javascript application i have added a simple table where i have enabled the "enableRowSelection" has in the example.
I can see the checkbox but when i click on them this wont change their status and they will remain unselected.
I have made an easy table only to try the functionality but i am not able to make it working and i am not able to understand why is not working.
Minimal, Reproducible Example - (Optional, but Recommended)
import { useMemo } from 'react';
import {
MaterialReactTable,
useMaterialReactTable,
} from 'material-react-table';
//nested data is ok, see accessorKeys in ColumnDef below
const data = [
{
name: {
firstName: 'John',
lastName: 'Doe',
},
address: '261 Erdman Ford',
city: 'East Daphne',
state: 'Kentucky',
},
{
name: {
firstName: 'Jane',
lastName: 'Doe',
},
address: '769 Dominic Grove',
city: 'Columbus',
state: 'Ohio',
},
{
name: {
firstName: 'Joe',
lastName: 'Doe',
},
address: '566 Brakus Inlet',
city: 'South Linda',
state: 'West Virginia',
},
{
name: {
firstName: 'Kevin',
lastName: 'Vandy',
},
address: '722 Emie Stream',
city: 'Lincoln',
state: 'Nebraska',
},
{
name: {
firstName: 'Joshua',
lastName: 'Rolluffs',
},
address: '32188 Larkin Turnpike',
city: 'Charleston',
state: 'South Carolina',
},
];
const Example = () => {
//should be memoized or stable
const columns = useMemo(
() => [
{
accessorKey: 'name.firstName', //access nested data with dot notation
header: 'First Name',
size: 150,
},
{
accessorKey: 'name.lastName',
header: 'Last Name',
size: 150,
},
{
accessorKey: 'address', //normal accessorKey
header: 'Address',
size: 200,
},
{
accessorKey: 'city',
header: 'City',
size: 150,
},
{
accessorKey: 'state',
header: 'State',
size: 150,
},
],
[],
);
const table = useMaterialReactTable({
columns,
data, //data must be memoized or stable (useState, useMemo, defined outside of this component, etc.)
enableRowSelection: true,
});
return <MaterialReactTable table={table} />;
};
export default Example;
Screenshots or Videos (Optional)
2024-04-12-10-06-02.mp4
Do you intend to try to help solve this bug with your own PR?
No, because I do not know how
Terms
- I understand that if my bug cannot be reliably reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.