简体   繁体   中英

material ui datagrid a status menu in table cell

I would like to add a column like Filled Status

But I cannot figure out how to do it from the docs, I feel like I have to use renderCell when setting up the column but I can't see how to accomplish it.

https://mui.com/components/data-grid/demo/

https://mui.com/components/data-grid/columns/

在此处输入图像描述

I recommend you use the renderCell property, which is more effective for substituting the content of a cell.

<DataGrid rows={[]} columns={[
  {
     field:"status",
     align:"center",
     headerName:"User status",
     renderCell({ row }){
        return <Menu>
          <MenuItem children="ACTIVE"/>
          <MenuItem children="INACTIVE"/>
         </Menu>
     }
  }
]} />

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