javascript - 将 mui-datatables 数据的全选复选框添加为对象(自定义列)
问题描述
当我的数据是对象格式(自定义列)而不是像带有大量样本的字符串的数组时,我无法在 mui-datatables 中添加一个复选框以选择全部。按照此处的文档,我尝试了使用customHeadRender
功能,但没有被调用,我尝试使用customToolbar
,它将加载全选复选框,但是当您选择行时触发,我需要在页面加载时使用该复选框。
谢谢
解决方案
只需selectableRowsHeader: true,
在你的options
道具中使用,你会没事的。
...
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)
...
工作演示在这里
推荐阅读
- html - Social icons in footer inline with text
- kubernetes - Kubernetes:如何在另一个集群中重用 pvc 和 pv
- react-apollo - Apollo 客户端延迟请求
- jquery - 如何在淘汰赛中不断更新绑定到视图的值数据
- sql - SQL column name with comma
- c# - 从文件夹中获取所有文件及其信息
- ffmpeg - 使用 ffmpeg 或 ffplay 播放问题
- javascript - 我无法将值传递给函数
- android - Pusher Beams - 推送通知取消订阅在 android 中不起作用
- gulp - 什么是项目进行 gulp 集成的最佳时间或阶段?