onRowClick with dataFormat returns undefined row Value

Đang mở
#2,105 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
javascript, react
Lĩnh vực
frontend

Hướng nghiên cứu

Tái hiện cấu hình bảng bằng onRowClick, TableHeaderColumn và dataFormat, bao gồm cả hai trường ActionsBtn và titleFormatter. Theo dõi cách dataFormat ảnh hưởng đến giá trị được truyền vào onRowClick; hoàn thành khi các trường văn bản đã được định dạng cung cấp một giá trị có thể sử dụng, trong khi các trường hành động có thể tiếp tục được loại khỏi điều hướng theo hàng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
JavaScript
Star
2.2k
Fork
753
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AllenFang/react-bootstrap-table

Tất cả issue của AllenFang/react-bootstrap-table

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.