gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.71k stars 934 forks source link

how to remove or make checkbox color transperent if isRowSelectable value false in MuiDataTable #2006

Open SrinivasChary066 opened 1 year ago

SrinivasChary066 commented 1 year ago

i would like to remove or make checkbox invisible on screen when isRowSelectable false i have researched and tried so much but im unable to achieve this outcome with MuiDataTable

is there any way that we can remove or make checkbox color transperent when row is desable

here is my state data for datatable

const data = [
    {
      isSelected: true,
      name: "Jhon",
      title: "leader",
      location: "house",
      isDisabled: true
    },
    {
      isSelected: false,
      name: "don",
      title: "ruler",
      location: "on table",
      isDisabled: false
    },

and here are my options

i have tried mutiple ways its not working for me

with MuiTheme

const getMuiTheme = () =>
    createTheme({
      overrides: {
        MUIDataTableSelectCell: {
          desabled: {
            color: "yellow !important"
          }
        }
      }
    });

with table options

CheckboxProps: {
      style: {
        color: "blue" // Change this to the desired checkbox color
      }
    },

here is the condition for making desabled row

isRowSelectable: (dataIndex) => !stateData[dataIndex].isDisabled,

im able to gray out the desabled row

setRowProps: (row, index) => {
      const rowProps = {};
      if (stateData[index].isDisabled) {
        rowProps.style = {
          backgroundColor: "lightGray"
        };
      }

      console.log(rowProps);
      return rowProps;
    }

but how can i do to checkbox as well

here is my sandcode box https://codesandbox.io/s/serverless-glade-2bzlg7