我想自定义 mui-datatble 中的行帽数据,如果我在选项中选择“是”,则背景颜色应为红色,如果我选择“否”,则背景颜色应为蓝色。我第一次使用 mui-datatable。
我无法使用 customRowRender 或 customRender。我们如何在 mui-datatable 中使用它
import React from 'react';
import MUIDataTable from "mui-datatables";
class Datatable extends React.Component {
render() {
const columns = [
{
name: "name",
label: "Name",
options: {
filter: true,
sort: true,
customRowRender:(data, dataIndex, rowIndex) => {
console.log('data' + data);
return (
<div>
{data}{' '}{dataIndex}{' '}{rowIndex}
</div>
);
}
}
},
{
name: "company",
label: "Company",
options: {
filter: true,
sort: false,
}
}
];
const data = [
{ name: "Joe …Run Code Online (Sandbox Code Playgroud)