AllenFang / react-bootstrap-table

A Bootstrap table built with React.js
https://allenfang.github.io/react-bootstrap-table/
MIT License
2.24k stars 783 forks source link

onRowClick with dataFormat returns undefined row Value #2105

Open misterpotpot opened 4 years ago

misterpotpot commented 4 years ago

Hello,

I have a table with items and the user can click on a row to go to the item page. In this table, I have "Text" fields and "ActionsBtn" fields (such as duplicate, sort, delete) I want the onRowClick be working solely with text field.

I use custom dataFormat for the "ActionsBtn" fields to render it.

So I twist my onRowClick function as such to be able solely to work if the user click on a field which is a "Text field".

const onRowClick = (row, value) => { if (value !== undefined) { localStorage.setItem("prestation", row.id); history.push("/prestation#tariffs"); } };

It works well as all fields render via a dataFormat function render an undefined value. For instance : <TableHeaderColumn dataField="duplicate" dataFormat={DuplicateBtn}>

But now I have a problem, I am using also dataFormat for specific "Text" fields (to display a tooltip or to display correctly number Values for instance). For instance : <TableHeaderColumn dataField="title" dataFormat={titleFormatter}>

To sumarize :

Thanks in advance for any help or idea. I am stucked on this issue.

Best, Jérémy