Data grid editing including cell selection

1 Answer 74 Views
Grid
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Bernd asked on 11 May 2022, 09:03 AM

Hi.

I have created a grid with editing as described in your example here:

https://www.telerik.com/kendo-react-ui/components/grid/editing/editing-custom/

The issue I have now is that I also have row selection enabled for the grid with a checkbox as described in this example:

https://www.telerik.com/kendo-react-ui/components/grid/selection/

My issue is now, that when the edit dialog opens for any field, and I click in a field to edit the value, the checkbox for the row selection gets activated. So the question is: How can avoid to activate the row selection when a row is in Edit mode?

 

1 Answer, 1 is accepted

Sort by
0
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
answered on 11 May 2022, 09:30 AM

Ok, I found a solution myself. The GridSelectionChangeEvent has the selected Row as startRowIndex. So I could check the dataItems in the event data for the row if the inEdit flag is set and then ignore the row selection. Code excerpt:


    const onSelectionChange = React.useCallback(
        (event: GridSelectionChangeEvent) => {
            const selectedRow: number = event.startRowIndex;
            if (!event.dataItems[selectedRow].inEdit) {
... handle selection event ... 

Hope this helps somebody...

 

Filip
Telerik team
commented on 12 May 2022, 08:18 AM

Hi, Bernd,

I am glad to hear that you have found a working solution. Thank you for sharing it, it might indeed prove useful to other users.

Regards,Filip

Tags
Grid
Asked by
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Answers by
Bernd
Top achievements
Rank 5
Bronze
Bronze
Bronze
Share this question
or