gregnb / mui-datatables

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

Checkbox functionality through customBodyRender #454

Open dsrini-open opened 5 years ago

dsrini-open commented 5 years ago

More of a question than a bug - How should one go about working with checkbox on as bodyrender for a column - I have defined the column like - { name: "check", label: "Check me", options: { customBodyRender: (value, tableMeta, updateValue) => { return (

{ console.log(event.target.value); updateValue(event); }} aria-label="My flag" />
        );
      }
    }
  }

How should I update the column value when checkbox is selected or modified?

Your Environment

Tech Version
Material-UI 3.9.2
MUI-datatables 2.0.0-beta-54
React 16.*
gabrielliwerant commented 5 years ago

You need to use onChange and updateValue inside of that. There are examples of how to do this here: https://github.com/gregnb/mui-datatables/blob/master/examples/component/index.js.