How does grid cell selection work with custom cells?

1 Answer 739 Views
Grid
Andrew
Top achievements
Rank 1
Andrew asked on 06 Jan 2022, 04:29 PM

Hello,

I have been working on implementing grid cell selection into some kendo react grids which are currently using custom cells for every cell and I have not been able to figure out how to implement the onSelectionChange event handling for the custom cells. I have looked for examples and forum posts about it, but so far haven't been able to find anything using custom cells (which appear to behave differently and don't want to handle the onSelectionChange event when clicked).

Here is a sample I have put together of what I am trying to do, but so far have had no luck with: https://stackblitz.com/edit/react-ts-gj4rce?file=index.tsx

Any feedback or help with this would be great!

Thanks,

Andrew


1 Answer, 1 is accepted

Sort by
0
Accepted
Filip
Telerik team
answered on 07 Jan 2022, 02:58 PM

Hello, Andrew,

In order for the cell selection to work correctly, you will have to include the td attributes from the GridCellProps, as shown in this article:

https://www.telerik.com/kendo-react-ui/components/grid/cells/#toc-customization

The main idea here is to add the correct class to the cell, which happens through props like shown in the following example:

https://stackblitz.com/edit/react-ts-tderh2?file=CustomCell.tsx

I hope this helps.

Regards,
Filip

Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Andrew
Top achievements
Rank 1
commented on 07 Jan 2022, 03:04 PM | edited

Thanks, this is what I was missing.
Tags
Grid
Asked by
Andrew
Top achievements
Rank 1
Answers by
Filip
Telerik team
Share this question
or