I am using kendo ui grid. In that I used batch mode to save values. If I changed the record in one row, then the value with the corresponding row will also be changed, and when we click on save, both fields will be saved in the database.
For example, I have a grid like:
Integer Value
1 First
2 Second
3 Third
4 Fourth
If I change the value from 1 to 4, then the value 4 will change, and the values will also change dynamically. I mean, I want to exchange 1 and 4 here. And also I can change the remaining fields are also saved, but finally, all records must be saved in the database. I tried both
This code will be in the grid change function
var grid = $('#grid').data("kendoGrid");
var selectedRow = grid.select();
var selectedRowIndex = selectedRow.index();
console.log(selectedRowIndex);
var firstItem = dataSource.data()[selectedRowIndex];
var datalength = dataSource.data();
for (var i = 0; i < datalength.length; i++)
{
var dataItem = datalength[i].id;
if (dataItem == firstItem.get('id'))
{
var secondItem = dataSource.data()[i];
secondItem.set('id', dataItem);
}
}
Then the values change, but the values do not go to the controller after changing it.