最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - React bootstrap table with tooltip - Stack Overflow

programmeradmin5浏览0评论

I am using a react bootstrap table to display some data stored in the info array.

<BootstrapTable data={info} striped={true} hover={true} search={true} condensed={true} selectRow={selectRowProp(onRowSelect, info, selected)}>
    <TableHeaderColumn isKey={true} dataField="name"> Name </TableHeaderColumn>
    <TableHeaderColumn dataField="class"> Class </TableHeaderColumn>
    <TableHeaderColumn dataFormat={myStyle} dataField="price"> Price </TableHeaderColumn>
</BootstrapTable>

Some of the rows may have an extra property oldPrice, which I would like to show as a tooltip over the shown price. How can I do that?

I am using a react bootstrap table to display some data stored in the info array.

<BootstrapTable data={info} striped={true} hover={true} search={true} condensed={true} selectRow={selectRowProp(onRowSelect, info, selected)}>
    <TableHeaderColumn isKey={true} dataField="name"> Name </TableHeaderColumn>
    <TableHeaderColumn dataField="class"> Class </TableHeaderColumn>
    <TableHeaderColumn dataFormat={myStyle} dataField="price"> Price </TableHeaderColumn>
</BootstrapTable>

Some of the rows may have an extra property oldPrice, which I would like to show as a tooltip over the shown price. How can I do that?

Share Improve this question asked Jun 24, 2016 at 13:30 MahdiMahdi 1,8821 gold badge22 silver badges38 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

Related, if you want to display the cell's value on hovering, you need to write a little function:

const columnHover = (cell, row, enumObject, rowIndex) => {
    return cell
  }

<TableHeaderColumn
    width='260px'
    dataField='cellContents'
    editable={false}
    dataSort
    columnTitle={columnHover}
    >
    Some text
</TableHeaderColumn>

You can use columnTitle property as columnTitle="Put your old price here"

<TableHeaderColumn dataFormat={myStyle} dataField="price" columnTitle="Put your old price here"> Price </TableHeaderColumn>

Set your tooltip ponent up outside the BootstrapTable. Use the columnClassName attribute on TableHeaderColumn to give your price cells a class that you can attach your tooltip to using tether.

发布评论

评论列表(0)

  1. 暂无评论