简体   繁体   English

MUI-Datatable:显示数据显示此错误 Cannot read properties of undefined (reading 'split')

[英]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.

相关问题 mui 数据表无法读取未定义的属性(读取“下载”) - mui datatable Cannot read properties of undefined (reading 'download') MUI 错误:无法读取未定义的属性(读取“抽屉”) - MUI error: Cannot read properties of undefined (reading 'drawer') 无法读取未定义的属性(读取“拆分”),如何消除错误 - Cannot read properties of undefined (reading 'split'), how to remove error MUI 警报未捕获类型错误:无法读取未定义的属性(读取“光”) - MUI Alert Uncaught TypeError: Cannot read properties of undefined (reading 'light') MUI 5 无法读取未定义的属性(读取“向上”),使用 makestyles 时 - MUI 5 Cannot read properties of undefined (reading 'up'), When using makestyles (MUI 文本字段)未捕获的 TypeError:无法读取未定义的属性(读取“焦点”) - (MUI Textfield) Uncaught TypeError: Cannot read properties of undefined (reading 'focus') 错误:未捕获(承诺中)类型错误:无法读取未定义的属性(读取“数据”) - ERROR: Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'data') useEffect 显示数据,然后无法读取 undefined 的属性 - useEffect shows data and then cannot read properties of undefined 错误:无法读取未定义的属性(读取“get”) - Error: Cannot read properties of undefined (reading 'get') 错误无法读取未定义的属性(读取“indexOf”) - error cannot read properties of undefined (reading 'indexOf')
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM