onRowMouseOver不在react-bootstrap-table中触发

时间:2017-07-15 01:46:34

标签: twitter-bootstrap react-bootstrap-table

我的表是:

    <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的文档,如果我鼠标悬停,该函数应该被触发。它不是。对我做错了什么的想法?

1 个答案:

答案 0 :(得分:4)

尝试使用以下内容检查功能

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

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