I am using MUI-Datatables to display retrieved data. my requirement is to highlight the row according to the matched data. I was able to do this using 'setrowProps' which is only working if I compare it with the text like 'operations'. I have an array to be highlighted. Don't know how to highlight those rows using arrays. please help, here is my code
let content = [
{id:20, name:'Jack Daniel', title:'accounting'},
{id:21, name:'Sophie McDonald', title:'operations'},
{id:22, name:'Jason Thomas', title:'hospitality'},
{id:23, name:'Chris Williams', title:'kitchen'}
]
let highlight = [
0:"operations"
1: "kitchen"
]
const containmentOptions = {
filterType: 'multiselect',
selectableRows: 'none',
confirmFilters: true,
setRowProps: (row, dataIndex, rowIndex) => {
return {
className: clsx({
highlight.map(item=>{
[this.props.classes.new]: row[2] === item[0];
})
}),
}
}
}
//It is giving me an error at highlight "unexpected token"
[this.props.classes.new]: row[2] === 'operations' // the row gets highighted but not with array
question from:
https://stackoverflow.com/questions/65944397/highlight-certain-rows-matched-with-data-array-in-mui-datatables 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…