【问题标题】:MUI-DataTables, How to customize filter dropdown select with extra column containing iconMUI-DataTables,如何使用包含图标的额外列自定义过滤器下拉选择
【发布时间】:2021-11-04 23:47:14
【问题描述】:

我正在使用 MUI-DataTables (gregnb) 并希望通过在下拉列表中添加一个额外的列来自定义过滤选项卡中的多选下拉列表。
可能吗?它会在 filteroptions.display 中吗?或 customFilterListOptions (我用它来自定义芯片中的文本),如果是这样,请怎么做。

谢谢

【问题讨论】:

    标签: filter dropdown multiple-columns multi-select mui-datatable


    【解决方案1】:

    我得到了它:指定 filterType = 'custom' 并返回 Material-ui 标记。即

    filterType = 'custom';
    filterOptions = {
        names: getMyArray(),
        logic: (value, filters) => { ......
        },
         display: (filterList, onChange, index, column) => {
            return (
               <FormControl>
                  <InputLabel htmlFor="select-multiple-chip">Location</InputLabel>
                      <Select
                          className ={class1.A}
                          multiple
                          value={filterList[index]}
                          renderValue={(selected) => selected.join(", ")}
                          onChange={(event) => {
                          filterList[index] = event.target.value;
                          onChange(filterList[index], index, column);
                      }}
                      >                                                     
    
                      {locArr.map((name, name2) =>(
                          <MenuItem key={id} value={name}  className ={classesF.A}>
                              <Checkbox className ={classesF.D} />
                              <ListItemText primary={name}/>
                              <ListItemText primary={name2}/>
                         </MenuItem>
                     ))}
                </Select>
           </FormControl>
       );
    

    }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-19
      • 2012-10-14
      • 2021-04-01
      • 1970-01-01
      • 2015-08-09
      相关资源
      最近更新 更多