[英]MUI-Datatable: Displaying the data shows this error Cannot read properties of undefined (reading 'split')
When I added data
here inside the MuiDatatable
, it will show this error当我在MuiDatatable
中添加data
时,它会显示此错误
Cannot read properties of undefined (reading 'split')无法读取未定义的属性(读取“split”)
How do I fix this and display the data?我该如何解决这个问题并显示数据?
I have recreated the issue in codesandbox: https://codesandbox.io/s/xenodochial-fog-s984v0?file=/src/App.js我在 codesandbox 中重现了这个问题: https://codesandbox.io/s/xenodochial-fog-s984v0?file=/src/App.js
Codes:代码:
export default function App() {
console.log(data);
const columns = [
{
name: "id",
label: "System ID", //or the order ID here
options: {
filter: true,
sort: true,
display: false
}
},
{
label: "Name",
options: {
filter: true,
sort: true
}
},
{
label: "Address",
options: {
filter: true,
sort: true
}
},
{
label: "Cart Items",
options: {
filter: true,
sort: true
}
},
{
label: "Total Amount",
options: {
filter: true,
sort: true
}
}
];
const options = {
filter: true,
selectableRows: "none",
responsive: "simple"
// onRowClick: handleRowClick,
};
return (
<div className="App">
<ThemeProvider theme={createTheme()}>
{" "}
<MUIDataTable
title={"Reports"}
options={options}
columns={columns}
data={data}
/>
</ThemeProvider>
</div>
);
}
Where is your data defined?你的数据在哪里定义的? Please make sure that data is an array of objects with structure as your columns array of the table.请确保数据是一个对象数组,其结构作为表的列数组。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.