React Bootstrap OverlayTrigger and Tooltip issue

前端 未结 2 1054
别那么骄傲
别那么骄傲 2021-01-13 15:14

I am trying to use react-bootstrap OverlayTrigger and Tooltip inside of a formatter for react-bootstrap-table and keep getting the following error:

OverlayTrigger\'s

相关标签:
2条回答
  • 2021-01-13 15:46

    I had the same problem. I can't explain why but I simply solved by adding a tag inside OverlayTrigger tag. My formatter function is inside a React Class.

    My solution:

    tooltipFormatter(cell, row){
        return (<OverlayTrigger placement="right" overlay={<Tooltip id={String(row.id)}>{cell}</Tooltip>}><span>{cell}</span></OverlayTrigger>);
    };
    

    Here, span tag solved the problem.

    If I adapt your code, here's the solution :

    submitterFormatter(submitter, row){
        return (<OverlayTrigger placement="bottom" overlay={<Tooltip id={String(row.id)}>{submitter}</Tooltip>}><span>{submitter}</span></OverlayTrigger>);
    };      
    

    Then, when I call in dataFormat parameter of TableHeaderColumn:

    <TableHeaderColumn dataField="comment" dataFormat={this.tooltipFormatter}>TableHeader</TableHeaderColumn>
    
    0 讨论(0)
  • 2021-01-13 15:50

    It's likely that either submitter or toolTipInstance are either null/undefined or one of them is an array of more than 1 component.

    0 讨论(0)
提交回复
热议问题