【发布时间】:2022-07-28 22:29:36
【问题描述】:
我正在尝试在数据网格中使用嵌套值对数据进行排序 但是在数据网格列的 sortComparator 上未定义
代码: 列数据设置:
{
headerName: 'Title',
field: `${this.props.type}.title`,
width: 500,
type: "string",
renderCell: (valueReceived) => this.getImageorVideoLogo(valueReceived.row),
sortComparator: this.titleSorting
}
titleSorting = (a,b)=>{
console.log(a);
console.log(b);
}
数据网格:
<DataGrid
rows={rowsDataGrid}
columns={columnsDataGrid}
components={{
Toolbar: this.getSearchTextField
}}
pageSize={5}
rowsPerPageOptions={[5]}
// checkboxSelection
// disableSelectionOnClick
autoHeight
/>
两个控制台打印未定义的问题 理想情况下,它应该给出整行 a 和行 b 或至少行 a 列数据和行 b 列数据
【问题讨论】:
标签: javascript reactjs material-ui