AllenFang / AllenFang/react-bootstrap-table

onRowClick with dataFormat returns undefined row Value

Open
#2,105 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
761
PR merge metrics
No merged PRs in 30d

Description

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 :
``

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 :
``

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.