javascript - 如何更改react-table中单行的边框颜色
问题描述
我知道如何更改ReactTable
对象中一行的背景颜色(下面的代码)。
如何更改行边框的颜色(不是整个表格的边框)?我尝试将background
以下代码中的代码替换为border-color
, or borderColor
, or border
,但这些选项都不起作用 - 要么,我得到一个错误,要么在编译时根本没有发生任何事情。
getTrProps={(state, rowInfo, column) => {
if(rowInfo) {
return {
style: {
background: "blue"
}
};
}
return {};
}
解决方案
像这样:
getTrProps = (state, rowInfo, instance) => {
if (rowInfo) {
return {
style: {
border: rowInfo
? rowInfo.row.age >= 20
? "solid 1px black"
: "none"
: "none"
}
};
}
return {};
};
工作示例: https ://codesandbox.io/s/react-table-gettrprops-ijgzy
推荐阅读
- javascript - 根据输入变化的搜索条件过滤数组内容
- mysql - 简单存储过程参数导致未知错误
- typo3 - TYPO3:自定义扩展 - “扩展名称不能为空”错误
- python - 如何将 For 循环数据写入 CSV 文件
- amazon-web-services - Elasticsearch 快照永久保存
- python - 输入正确密码后无法关闭 Tkinter 的弹出窗口
- java - InternalResourceViewResolver 找不到页面
- python - 为什么来自 URL 的参数在 Django 中返回为未定义?
- javascript - 动画完成后如何调用jQuery动画功能?
- javascript - 打字稿开发环境