我有一种情况,我必须根据行道具更改行的背景颜色。我目前正在这样做:
const getTrProps = (state, rowInfo, instance) => {
if (rowInfo) {
return {
style: {
'background-color': rowInfo.original.customercomplaints.order_ref === currentOrderId ? '' : 'yellow',
}
}
}
return {};
}
中react-table
,是这样的:
<ReactTableFixedColumns className="-striped"
columns={customerComplaintsColumns}
data={customerComplaintsData}
daultPageSize={10}
defaultFilterMethod={filterCaseInsensitive}
getTrProps={getTrProps}
/>
如果我检查元素,我会得到:
<div class="rt-tr -even" role="row" style="background-color: yellow;">
但它不适用于行。我该如何解决这个问题?
我的react
版本是^16.13.1
,react-table
版本是6.8.6
。