Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React bootstrap table with tooltip

Tags:

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?

like image 281
Mahdi Avatar asked Jun 24 '16 13:06

Mahdi


People also ask

How do I use Bootstrap tooltip in react?

We can use the following approach in ReactJS to use the react-bootstrap Tooltip Component. Tooltip Props: arrowProps: It is used to position the tooltip arrow. id: It is just an HTML id attribute that is necessary for accessibility.

What is tooltip in react?

Tooltips display informative text when users hover over, focus on, or tap an element.

What is overlay react?

React Overlays is a toolkit for creating functional overlays, tooltips, modals, and dropdowns. It is not a UI framework but is meant to be incorporated into frameworks. To make those integrations possible, React Overlays is style-agnostic and does not come with any CSS.

Is react bootstrap responsive?

Bootstrap's grid system uses a series of containers, rows, and columns to layout and align content. It's built with flexbox and is fully responsive.


2 Answers

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>
like image 51
Siddhartha Avatar answered Oct 03 '22 10:10

Siddhartha


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>
like image 25
Shivprsad Sammbhare Avatar answered Oct 03 '22 10:10

Shivprsad Sammbhare