2

我的桌子是:

    <BootstrapTable options={this.state.tableOptions} className="animated fadeIn" data={opportunities} striped hover condensed>
      <TableHeaderColumn dataField='ticker' dataSort={true} dataFormat={this.symbolFormatter} dataAlign='center'>Symbol</TableHeaderColumn>
      <TableHeaderColumn dataField='symbol' dataFormat={this.strategyFormatter} className="clearfix" dataSort={true} dataAlign='center'>Strategy</TableHeaderColumn>
      <TableHeaderColumn dataField='probability' dataFormat={this.percentFormatter} dataSort={true} dataAlign='center'>Probabilty</TableHeaderColumn>
      <TableHeaderColumn dataField='shamoonRank' dataFormat={this.progressFormatter} dataAlign='center' dataSort={true}>Should I Do It?</TableHeaderColumn>
      <TableHeaderColumn dataField='spread' dataFormat={this.currencyFormatter} dataAlign='center' dataSort={true}>Spread</TableHeaderColumn>
      <TableHeaderColumn dataField='maxLoss' dataFormat={this.currencyFormatter} dataAlign='center' dataSort={true}>Max Loss</TableHeaderColumn>
    </BootstrapTable>

我的选择如下:

this.state = {
  animatedClass: 'hidden',
  opportunityId: null,
  tableOptions: {
    defaultSortOrder: 'desc',
    onRowMouseOver: (row) => {
      console.log('row')
    }
  }
}

根据react-bootstrap-table的文档,如果我将鼠标悬停,该功能应该被触发。它不是。对我做错了什么有任何想法吗?

4

1 回答 1

4

尝试使用以下检查功能,

   this.state = {
          console.log('state called')
      animatedClass: 'hidden',
      opportunityId: null,
      tableOptions: {
        defaultSortOrder: 'desc',
        onRowMouseOver: (row) => {
          console.log('row')
        }
      }
    }

如果日志没有工作,请尝试删除 TableHeaderColumn 并使用简单表并尝试触发。它对我有用

于 2017-07-25T13:39:56.000 回答