react-data-grid icon indicating copy to clipboard operation
react-data-grid copied to clipboard

dblClick row dblClick event

Open ghost opened this issue 10 years ago • 3 comments

How can I add a double-click event on a row?

ghost avatar Jan 03 '16 13:01 ghost

hey @mohak1990,

you can do this using a Custom Row Renderer (see http://adazzle.github.io/react-data-grid/examples.html#/custom-row-renderer)

your component would be something like:

var RowRenderer = React.createClass({

 PropTypes: {
   onDoubleClick: React.PropTypes.func
 },

 render: function() {
   return (<ReactDataGrid.Row ref="row" {...this.props} onDoubleClick={this.props.onDoubleClick} /></div>)
 }
});
function onDoubleClick(e) {
  // handle click event here
}

var Example = React.createClass({
  render: function() {
    return  (<ReactDataGrid
    columns={columns}
    rowGetter={rowGetter}
    rowsCount={_rows.length}
    minHeight={500}
    rowRenderer={<RowRenderer onDoubleClick={this.onDoubleClick} />} />);
  }
});

jpdriver avatar Jan 13 '16 14:01 jpdriver

This doesn't work.

lorenzoid avatar Feb 28 '17 19:02 lorenzoid

@jpdriver this does not work. Should I add this as another porp to React Data Grid and handle it ?

I think this is happening because we do event.stopPropogation in the click handlers on cell.

mrgurdeep avatar Nov 08 '17 09:11 mrgurdeep