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

Kendo Grid- clicking on "Save Changes" saving new data(newly added row) even required fields are not filled in.

0 Answers 415 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Naren
Top achievements
Rank 1
Naren asked on 09 Mar 2012, 10:30 PM

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.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Naren
Top achievements
Rank 1
Share this question
or