我有一个 MUI 表实现,使得选项对象 viewColumns 设置为 true,这应该显示弹出器以选择要在复选框的垂直列表中显示的列,如下所示:
,但我是水平获取它,如下面的屏幕截图所示:
MUIDataTable 组件中要传递的选项定义为:
const options = {
filter: true,
filterType: "dropdown",
print: false,
viewColumns: true,
selectableRows: false,
onRowClick: (rowData) => {
console.log("RowClicked->", rowData);
},
responsive: "stacked",
fixedHeaderOptions: {
xAxis: false,
yAxis: true,
},
};
列定义为:
export const DEAL_GRID_COLUMNS = [
{
name: "someReference",
label: "Some Reference",
options: {
filter: true,
sort: true,
},
},
{
name: "businessTeam",
label: "Business Teams",
options: {
filter: true,
sort: true,
},
},
{
name: "keyContact",
label: "Key Contact Lead",
options: {
filter: true,
sort: true,
},
},
.....
.....
.....
.....
];
并且该组件被消耗为
<MUIDataTable data={gridData} columns={DEAL_GRID_COLUMNS} options={options} />
这gridData
是从 Api 响应中收到的