Griddle v1 onRowClick does not shoot

It was instructed to upgrade from Griddle v0.7 to Griddle v1.1. But I can not 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 at the problems in github or other examples, this should work fine.

+4
source share
2 answers

Griddle v1's solution for this would be to define RowEnhancer, to provide onClick, for example, this example :

  <Griddle
    components={{
      RowEnhancer: OriginalComponent =>
        props => (
          <OriginalComponent
            {...props}
            onClick={() => console.log(`Click Row ${props.griddleKey}`)}
            />
        ),
    }}
    ...
    />
0
source

There is no onRowClick like v1 (and still not in version v1.3.1). You need to create your own component or row cell if you want to add an action.

0
source

Source: https://habr.com/ru/post/1672251/


All Articles