Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Griddle v1 onRowClick not firing

Was tasked to upgrade from Griddle v0.7 to Griddle v1.1. But I can't seeme to get onRowClick to work.

import React, { Component } from 'react';
import Griddle from 'griddle-react';

export default class Table extends Component {
  render() {
    const data = [...something];

    return <Griddle
      data={data} 
      onRowClick={() => console.log("row clicked")} /> 
  }
}

If I look through the issues on github or other examples, this should work just fine.

like image 403
KasperVerner Avatar asked Nov 08 '22 00:11

KasperVerner


1 Answers

The Griddle v1 way to solve this would be to define a RowEnhancer to provide an onClick, like this example:

  <Griddle
    components={{
      RowEnhancer: OriginalComponent =>
        props => (
          <OriginalComponent
            {...props}
            onClick={() => console.log(`Click Row ${props.griddleKey}`)}
            />
        ),
    }}
    ...
    />
like image 194
dahlbyk Avatar answered Nov 14 '22 22:11

dahlbyk