how to manually set column value in kendo grid
Always use set()
method from the Model to change values. No need to refresh()
, e.g.:
var dataItem = $("#grid").data("kendoGrid").dataSource.data()[0];
dataItem.set("reason", "new value");
Demo
Based on validation is correct or not this is how you can update the first column value.
for (var i = 0; i < data.length; i++) {
//access record using for loop - here i is value from loop
var firstItem = $('#grid').data().kendoGrid.dataSource.data()[i];
//set col reason value value
firstItem["reason"]="username length";
//refresh the grid
$('#grid').data('kendoGrid').refresh();
}
Another way is to use dataitem set method as described in this post
The dataItem.set() method is VERY SLOW as it triggers an event each time. Even a list of 100 is notable slow.
To handle larger updates then use
dataItem[field] = value
The downside is that no dirty markers will be applied and the grid will not reflect the changes.
$('#grid').data('kendoGrid').refresh();