简体   繁体   English

材料表添加多选查找

[英]material-table add multiselect to lookup

I am using Material-Table to easily manage my data.我正在使用 Material-Table 来轻松管理我的数据。 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.我想要一个多选菜单,这样我就可以保存多个 id,最好是一个数组。

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.是的,您可以简单地覆盖列的editComponent来呈现您的自定义视图(这里是多选)并自己更新数据。

Here is a sandbox on how you could do it.这是一个关于如何做到这一点的沙箱

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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