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

Allow to customize Cell renderer

Open alamothe opened this issue 3 years ago • 0 comments

Currently, it's only possible to customize (whole) row renderer or column formatter, but not cell formatter.

We could add a property in Column:

cellRenderer?: Maybe<React.ComponentType<CellRendererProps<R, SR>>>;

(interestingly, CellRendererProps already exists in types)

If not set, it would use the default one.

One use case is expander column in master detail example: https://adazzle.github.io/react-data-grid/#/master-detail. Currently, it renders a span which captures keyboard events. But it would be better to capture keyboard events directly on the cell itself (it already has focus). So one definite use case is to be able to capture keyboard events on the cell (which already has focus), instead of trying to focus an element inside a cell.

Let me know what you think. I can send a PR if you would consider it

alamothe avatar Jan 27 '22 03:01 alamothe