2
votes

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

enter image description here

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?

1
how did you solve this? - Dries Coppens
Unfortunately your solution at github (github.com/mbrn/material-table/issues/…) doesn't work for the latest version. It throws TypeError: renderInput is not a function for the materialUI Autocomplete component - user3142695

1 Answers

1
votes

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.