I use the react-table
example at this official codesandbox.
The code for columns is like this:
const columns = React.useMemo(
() => [{
Header: 'Name',
columns: [{
Header: 'First Name',
accessor: 'firstName',
// Use a two-stage aggregator here to first
// count the total rows being aggregated,
// then sum any of those counts if they are
// aggregated further
aggregate: ['sum', 'count'],
Aggregated: ({
cell: {
value
}
}) => `${value} Names`,
},
{
Header: 'Last Name',
accessor: 'lastName',
// Use another two-stage aggregator here to
// first count the UNIQUE values from the rows
// being aggregated, then sum those counts if
// they are aggregated further
aggregate: ['sum', 'uniqueCount'],
Aggregated: ({
cell: {
value
}
}) => `${value} Unique Names`,
},
],
},
...
],
[]
)
How could one disable grouping for i.e. Last Name
column? I tried:
{
Header: 'Last Name',
accessor: 'lastName',
disableGrouping: true, // This line
},
But disableGrouping
does not work.
Best Regards