Skip to content

“Hide All” button stays active even when all hideable columns are hided. #1481

Open

Description

@Nakul-Jain-RTDS

material-react-table version

3.2.1

react & react-dom versions

18.3.1

Describe the bug and the steps to reproduce it

“Hide All” button stays active even when some columns are non-hideable instead of greying out creating a bad user experience. This happens only in case when any column is marked with enableHiding:false.

Minimal, Reproducible Example - (Optional, but Recommended)

import { useMemo } from 'react';
import { Box, Button } from '@mui/material';
import {
MaterialReactTable,
useMaterialReactTable,
type MRT_ColumnDef,
} from 'material-react-table';
import { data, type Person } from './makeData';

const Example = () => {
const columns = useMemo<MRT_ColumnDef[]>(
//column definitions...
() => [
{
accessorKey: 'firstName',
header: 'First Name',
},
{
accessorKey: 'lastName',
header: 'Last Name',
},
{
accessorKey: 'address',
header: 'Address',
},
{
accessorKey: 'city',
header: 'City',
},
{
accessorKey: 'state',
header: 'State',
},
],
[],
//end
);

const table = useMaterialReactTable({
columns,
data,
defaultDisplayColumn: {
enableResizing: true, //turn on some features that are usually off for all display columns
},
displayColumnDefOptions: {
'mrt-row-actions': {
size: 350, //set custom width
muiTableHeadCellProps: {
align: 'center', //change head cell props
},
},
'mrt-row-numbers': {
enableColumnDragging: true,
enableColumnOrdering: true, //turn on some features that are usually off
enableResizing: true,
muiTableHeadCellProps: {
sx: {
fontSize: '1.2rem',
},
},
},
'mrt-row-select': {
enableColumnActions: true,
enableHiding: true,
size: 100,
},
},
enableColumnResizing: true,
enableColumnOrdering: true,
enableRowNumbers: true,
enableRowSelection: true,
enableRowActions: true,
renderRowActions: ({ row }) => (
<Box sx={{ display: 'flex', gap: '1rem' }}>
Button 1
Button 2
Button 3

),
});

return ;
};

export default Example;

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

None

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions