react-bootstrap-table icon indicating copy to clipboard operation
react-bootstrap-table copied to clipboard

onRowClick with dataFormat returns undefined row Value

Open misterpotpot opened this issue 5 years ago • 0 comments

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 :

  • I have found a setup where onRowClick function works for all fields of the row
  • I have found a setup where onRowClick function works for all fields which are not rendered by dataFormat function
  • I cannot find a setup where the onRowClick function works on all non "ActionsBtn" field since the value render by any dataFormat is always undefined.

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

Best, Jérémy

misterpotpot avatar Apr 16 '20 09:04 misterpotpot