简体   繁体   中英

material-table add multiselect to lookup

I am using Material-Table to easily manage my data. It is fantastic, but for one feature. With the below code I get a select menu. I would like to have a multiselect menu, so i can save more then one id, ideally an array.

Current Select

在此处输入图片说明

Implementation

columns = [
  {
    title: 'Game Systems',
    field: 'gameSystemIds',
    type: 'numeric',
    lookup: {1: "40k", 2: "Fantasy"},
  },
]

<Table
   columns={columns}
   data={allManufacturers}
</>

Is it possible to use a multi select box?

Yes, you can simply override the editComponent prop of the columns to render your custom view ( here a multi select) and update the data yourself.

Here is a sandbox on how you could do it.

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