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.

Inconsistent parameters received on toggleSelection handler of selectTable HOC

See original GitHub issue

Right now, if you use the default input component, the toggleSelection handler gets called with these parameters:

onClick={(e)=>{
  const { shiftKey } = e;
  e.stopPropagation();
  props.onClick(props.id, shiftKey, props.row);
}}

If you use a custom SelectInputComponent, the toggleSelection receives the SyntheticEvent object from React. So it makes it impossible to know, for example, which row was clicked.

I think both methods should receive the same arguments.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nlucerocommented, Jan 26, 2018

Yeah, that works 👍

Just as an opinion, it would be nice if the user wouldn’t need to know how the HOC internally works in order to implement a custom Select Input component. Regardless of the Select Input component used on the table, the toggleSelection handler should receive the same parameters.

I will close this issue. Thanks for your help!

0reactions
gary-menzelcommented, Jan 25, 2018

you get the data you are asking for in the props.

Add this line to your render just before you return and you will see the props there…

    console.log('props',this.props);

You have to replicate the functionality of the default component otherwise it won’t work. Here is the source code pasted (it is in the code)…

const defaultSelectInputComponent = (props) => {
  return (
    <input 
      type={props.selectType || 'checkbox'} 
      checked={props.checked} 
      onClick={(e)=>{
        const { shiftKey } = e;
        e.stopPropagation();
        props.onClick(props.id, shiftKey, props.row);
      }} 
      onChange={()=>{}}  
    />
  )
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Inconsistent parameters received on toggleSelection handler ...
One possible solution: Wrap the call to toggleSelection in this line with another function that passes the correct arguments in (same way it's ......
Read more >
Why toggleSelection and isSelected method are receiving ...
The two handlers of interest are onClick (which maps to toggleSelection) and checked, which maps to isSelected. Notice the id here.
Read more >
material-ui/core/CHANGELOG.md - UNPKG
Each warning comes with a simple message that explains how to handle the deprecation. ... 594, - [Select] Fix height inconsistency between input...
Read more >
Cisco Prime Infrastructure Classic View Configuration Guide ...
To get the automated feedback enabled, you must configure your Mail Server Configuration by choosing Administration > Settings > Mail Server Configuration.
Read more >
User Guide - Trifacta Documentation
When a toolbar item is selected, the Transformer page is pre-populated with settings and values to get you started. As needed.
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