Validations are not firing if first column in the grid is readonly field for the newly added row.
My code will look like below.
var testModel = { id: "Id",
fields:{
Id: {editable: false, type: "number", defaultValue: -1, validation: { required: true} },
FirstName: {editable: true, defaultValue: "", validation: { required: true} }
}
Case 1:
Grid Columns: First column(FirstName) is editable
$("#grd").kendoGrid({ editable: true, toolbar: [
{ name: "create", text: "Add New Record" }, { name: "save", text: "Save Changes" }, { name: "cancel", text: "Cancel Changes" }
],
columns:[{field: "FirstName",width: 300,title: "First Name"} ]);
Step 1: Click on the "Add New Record" button.
Step2: Click on the "Save Changes" button with out entering required fields.
Validations are firing for First Name which is working fine in this case.
Case 2:
Grid Columns: First column(Id) is non editable
$("#grd").kendoGrid({editable:true, toolbar: [
{ name: "create", text: "Add New Record" }, { name: "save", text: "Save Changes" }, { name: "cancel", text: "Cancel Changes" }
],
columns:[{field: "Id",width: 50,title: "Id"}, {field: "FirstName",width: 300,title: "First Name"} ]);
Step 1: Click on the "Add New Record" button.
Step2: Click on the "Save Changes" button with out entering required fields.
Validations are not firing for First Name.
If first column is editable and user clicks on 'Add New Record' focus is going is editable column and validations are firing if try to save.
If first column is non editable and user clicks on 'Add New Record' then focus is going on readonly column and validations are not firing if try to save. Here grid is saving the data even validations are failed.
Please suggest me how to handle the above scenario.