This is a migrated thread and some comments may be shown as answers.

How to re-open cell for editing after closing it?

1 Answer 278 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 06 May 2017, 12:03 AM

I am using in-cell editing in the Kendo grid. I need to call the service layer for each record to determine whether it is editable. Therefore when the change event is received, I call the service layer for the selected records(). When the service layer result arrives, if it indicates not editable then I use grid.closeCell to prevent editing. When the edit event is received, I check if the previously received result indicates not editable, and if so then I use grid.closeCell to close the cell. (I am saving the service layer result by record ID so that I only need to call the service the first time a row is clicked.)

However I have a synchronization problem. The first time a row is clicked, the cell opens for editing, because the service layer result has not been received yet. If the row is not editable, then the cell closes when the service result is received. This is not good, as the user might think the cell is editable and start to edit the cell before it closes.

I would like to prevent the cell from opening in edit mode when it is clicked the first time, but I'm not sure how to do this. I tried modifying the change event actions by calling grid.closeCell before making the service layer call, but I'm not sure how to open the cell back up when I get back a result indicating that the row is editable. I thought I could use editCell, but that requires the jQuery of the cell. Since I get the result back under the change event, how do I know at that point which cell was clicked?

 

1 Answer, 1 is accepted

Sort by
0
Alex Hajigeorgieva
Telerik team
answered on 09 May 2017, 04:47 PM
Hello Kevin,

If I understand the scenario correctly,  the "service layer result by record ID"  is already saved at the time you wish to open a cell for editing.

If this is the case, is it possible to save the cell index (row and column) at the same time and retrieve it at that stage when it is needed again? Perhaps in a boolean matrix for quick reference?

Regards,
Alex Hajigeorgieva
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data (charts) and form elements.
Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Alex Hajigeorgieva
Telerik team
Share this question
or