React-table: Give onClick or OnMouseEnter effect to a single row

Created on 20 Apr 2017  路  7Comments  路  Source: tannerlinsley/react-table

Hello,

I'm trying to use getTrProps but it's triggering for all the rows. I want give effect to each row individually. Any suggestions!!

getTrProps={(state, rowInfo) => {
return {
OnClick:()=>{
}
}
}}

Thanks in Advance.

Most helpful comment

All 7 comments

Does this log anything when you click on rows?

getTrProps={(state, rowInfo) => {
  return {
    onClick: () => console.log(state, rowInfo)
  }
}}

Yes, it's logging the data that's available in that row. Actually what I'm trying to do is, I added a column which would have an Icon for each row and only would appear when I hover over a row. Right now when I'm hovering over a row, it's displaying all the Icons of all the rows. I added the Icon from column render.
I hope that makes sense :)

const column= [{
header: 'STATUS',
width:100,
render:row => close,
}

Does this solve your problem? http://codepen.io/tannerlinsley/pen/gWrRNV?editors=0110

I would suggest just using css. It would be much easier than trying to do it programmatically

That makes sense, but what if I want to change the color of a single whole row on hover not just icon action!!

Awesome, thank you so much for your time. Really appreciate that.

HI @tannerlinsley ,

I was looking into http://codepen.io/tannerlinsley/pen/gWrRNV?editors=0110.

and I have one question that how can i change row style on column click.

render: (row) => { const closeClick = () => { alert('clicked') }; return ( <div className='action'> <i onClick={closeClick} className="ion-edit" >close</i> </div> ) }

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexanderwhatley picture alexanderwhatley  路  3Comments

danielmariz picture danielmariz  路  3Comments

bdkersey picture bdkersey  路  3Comments

dwjft picture dwjft  路  3Comments

esetnik picture esetnik  路  3Comments