问题描述
我正在尝试为MUI-Datatable(https://github.com/gregnb/mui-datatables)组件设置选项。但是,在尝试提供选项时,似乎没有注册我从options对象提供的选项。 目前,我的代码如下:
const statements = [
{
date: moment().format('MM/DD'),details: 'Hello Chris,this is a wide details :)',deposit: 0,withdraw: 200,balance: 300,},{
date: moment().format('MM/DD'),details: '24/7 purchase',balance: 100,}
]
const columns = ['Date','Details','Paid in ($)','Paid out ($)','Balance ($)'];
const options = {
page: 9,pagination: false,};
statements.map((statement) => {
statement.deposit = (statement.deposit === 0) ? statement.deposit == null : statement.deposit;
statement.withdraw = (statement.withdraw === 0) ? statement.withdraw == null : statement.withdraw;
data.push(Object.values(statement));
});
return (
<MUIDataTable className={dataTable} data={data} columns={columns} option={options} />
);
但是,该表仍显示分页和每页10行。任何线索为什么会发生这种情况?
解决方法
我很愚蠢,在组件的options属性中缺少“ s”。