question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Table onRow Event multiple triggered

See original GitHub issue

Version

3.1.0

Environment

macos 10.12.6, chrome 63

Reproduction link

codepen

Steps to reproduce

My component which using Table component in 2.x versions, when I migrate to 3.x versions, console print out such errorwebpack-internal:///15:49 Warning: onRowClick is deprecated, please use onRow instead., when I replace onRowClick with onRow event, my Component BREAK DOWN, as I use setState with onRowClick[onRow]

What is expected?

event should be triggered when I click table item

What is actually happening?

it triggered when each line rendered


when I look into source code in Table component, https://github.com/ant-design/ant-design/blob/1eff817b9ada2169f0ddeb5e2e9fd2df88270134/components/table/Table.tsx#L218, why you execute props onRow event, cuz used in onRowClick is bind event, or maybe you have changed the usage purpose of this function

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:24 (4 by maintainers)

github_iconTop GitHub Comments

12reactions
aaronplanellcommented, Jan 26, 2018

Perfect!!!

It works with:

onRow={(record) => ({
    onClick: () => { myCallBackThatReceivesTheID(record.key); }
})}

Thanks a lot @yesmeck !!!

10reactions
dogbutcatcommented, Jan 10, 2018

@TimKraemer ,as @dengfuping said, the onRow event is to set props for each row, it means the work of onRow is changed, and you need to pass rowSelection[Object] props to deal with select events. You can checkout my modified codepen,OR check the document this part: https://ant.design/components/table/#rowSelection. Hope this helps. Also I think they should change the warning description as this props function totally changed, not instead.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Table onRow Event Triggered Multiple - CodePen
URL Extension Required. When linking another Pen as a resource, make sure you use a URL Extension of the type of code you...
Read more >
Reactjs: Antd Table onRowClick trigger all event
So i'm new to reactjs, im doing a table that when you click on 1 row it will render a detail description for...
Read more >
'select' and 'deselect' events triggering multiple times on row ...
I've read into using the table.rows( { selected: true } ).data(); function to get this data as well, but I would rather only...
Read more >
How to use Bots - Tables Help Center
1. Bot triggers. The bot trigger defines a particular event or time to "run" the bot and have it check its conditions and...
Read more >
CREATE TRIGGER statement - Oracle Help Center
For example, if you define a trigger for a delete on a particular table, the trigger's ... including multiple triggers on the same...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found