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.
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}`)}
/>
),
}}
...
/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With