首页 > 解决方案 > 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}

                />

问题:在执行此操作时,所有行都被选中,我只需要更改所选行的颜色

标签: reactjsreact-bootstrap-table

解决方案



推荐阅读