添加 select mui-datatables 数据的所有复选框作为对象(自定义列)
Add select all checkbox for mui-datatables data as object( custom columns)
当我的数据是对象格式(自定义列)时,我无法在 mui-datatables 中为 select all 添加一个复选框,而不是像一个带有字符串的数组,就像那里有很多样本。
按照文档 here,我尝试使用 customHeadRender
函数,但它没有被调用,我尝试使用 customToolbar
,它将加载 select 所有复选框,但触发当您 select 行时,我需要在页面加载时使用该复选框。
谢谢
这里是codesanbox
只需在您的 options
道具中使用 selectableRowsHeader: true,
就可以了。
...
const options = {
filterType: "textField",
fixedHeader: true,
sort: true,
search: true,
selectableRows: "multiple",
responsive: "scrollMaxHeight",
rowsPerPage: 15,
rowHove: true,
selectableRowsHeader: true, //<---------- this should be true (not false)
...
当我的数据是对象格式(自定义列)时,我无法在 mui-datatables 中为 select all 添加一个复选框,而不是像一个带有字符串的数组,就像那里有很多样本。
按照文档 here,我尝试使用 customHeadRender
函数,但它没有被调用,我尝试使用 customToolbar
,它将加载 select 所有复选框,但触发当您 select 行时,我需要在页面加载时使用该复选框。
谢谢
这里是codesanbox
只需在您的 options
道具中使用 selectableRowsHeader: true,
就可以了。
...
const options = {
filterType: "textField",
fixedHeader: true,
sort: true,
search: true,
selectableRows: "multiple",
responsive: "scrollMaxHeight",
rowsPerPage: 15,
rowHove: true,
selectableRowsHeader: true, //<---------- this should be true (not false)
...