reactjs - selectRow 上的 react-bootstrap-table-next 选择所有行
问题描述
要求:要更改选择行的背景颜色:
**npm package**: "react-bootstrap-table-next": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/react-bootstrap-table-next/-/react-bootstrap-table-next-4.0.3.tgz",
"integrity": "sha512-uKxC73qUdUfusRf2uzDfMiF9LvTG5vuhTZa0lbAgHWSLLLaKTsI0iHf1e4+c7gP71q8dFsp7StvkP65SxC1JRg==",
"requires": {
"classnames": "^2.2.5",
"react-transition-group": "^4.2.0",
"underscore": "1.9.1"
}
},
代码:
const selectRow = {
mode: 'checkBox',
// hideSelectColumn: false,
clickToSelect: true,
// clickToEdit: true,
color: '#def3ff',
};
<BootstrapTable
mode="radio"
size="sm"
className="small"
bordered={false}
striped
keyField="id"
data={historyData}
columns={columnsHistoryTable}
rowEvents={historyRowEvent}
selectRow={selectRow}
/>
问题:在执行此操作时,所有行都被选中,我只需要更改所选行的颜色
解决方案
const selectRow = {
mode: 'checkBox',
clickToSelect: true,
style: { background: '#def3ff' },
};
推荐阅读
- scala - 如何在给定两列和计数的 SPARK scala 中创建邻接矩阵
- python - 在一个循环中打印多个单独的直方图
- load-testing - Puppeteer:使用 puppeteer 进行负载测试
- php - php的提名错误
- phpexcel - 如何从mysql数据库动态导出excel文件中的图像
- javascript - 如何在 React Native 中实现执行时间长的代码?
- html - 如何解决scss中相同组件的不同颜色?
- prolog - 如何确定序言“复合词”内部是否有特定的“原子”?
- swift - tableview 内的 Collectionview 导致 2 列出现问题
- conv-neural-network - 如何在 MobileNet-SSD caffe 上进行增量学习