简体   繁体   中英

How to add custom checkbox in column in react material table?

Hi i am using material table in react project. I want to add a checkbox in my table cell. For example in Birth year colume in place of 1987. How to achieve that?

https://codesandbox.io/s/material-demo-forked-5h51b?file=/demo.js:701-911

在此处输入图片说明

<MaterialTable
      title="Editable Example"
      columns={state.columns}
      data={state.data}
      options={{
        selection: true
      }}
      editable={{
       //Edit Code here
      }}
    />

I found the answer... In column just add type:'boolean'. For eg,

    {
      title: "Unit",
      field: "unit",
      type: 'boolean',
      
    },

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM