This is a migrated thread and some comments may be shown as answers.
Preventing incell editing for SOME of the columns
1 Answer 4 Views
This is a migrated thread and some comments may be shown as answers.
Alon
Top achievements
Rank 1
Alon asked on 03 Dec 2020, 01:05 PM

I have a kendoGrid (for JQuery) with 5 columns. Lets say those columns are called columns A, B, C, D and E. I only want columns A and B to be inline editable. If the user clicks on Columns C, D, E I want nothing to happen. 

What event can I use to prevent the user from editing columns C, D and E while still allowing columns A and B to be inline editable?

I have tried using the beforEdit event but there seems to be no way to identify which cell is being edited. I have tried using the edit event but it is too late at this point. The field is all ready showing in EDIT mode to the user when this event is being called.

Any other ideas?

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 07 Dec 2020, 10:07 AM

Hi Alon,

In order to achieve the desired behavior, I would recommend using the schema model of the dataSource. Set the editable property for the needed fields to "false". Here is an example:

schema: {
                        model: {
                            id: "ProductID",
                            fields: {
                                ProductID: { editable: false, nullable: true },
                                ProductName: { validation: { required: true } },
                                UnitPrice: { type: "number", validation: { required: true, min: 1}, editable: false },
                                Discontinued: { type: "boolean", editable: false },
                                UnitsInStock: { type: "number", validation: { min: 0, required: true }, editable: false }
                            }
                        }
                    }

The complete implementation could be found in the following dojo example:

Give the approach above a try and let me know if further assistance is needed.

Kind Regards,
Anton Mironov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Alon
Top achievements
Rank 1
Answers by
Anton Mironov
Telerik team
Share this question
or