Jamie Hutber
Jamie Hutber

Reputation: 28076

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

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?

Upvotes: 2

Views: 4390

Answers (1)

Domino987
Domino987

Reputation: 8774

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.

Upvotes: 1

Related Questions