How to refresh the kendo ui grid after a ajax post is successful? Here is my grid ajax post:
var newUser = {
UserId: 0,
UserLoginName: currentRecord.UserLoginName,
UserDisplayName: currentRecord.UserDisplayName
};
//insert selected rows using DataSource insert method
destinationGrid.dataSource.insert(newRecord);
//ajax post to server
var url = '@Url.Action("CreateUser", "ManageUsers")';
$.post(url, { loginid: currentRecord.UserLoginName, name: currentRecord.UserDisplayName, role: roleSelected }, function (result) {
if (result.Success) {
**////grid is not refreshing as I want to refersh the grid again from database**
destinationGrid.dataSource.read();
}
});
}
This is just example
Controller
if you need to refresh your grid as soon as complate controller action do this,
$('#gridName').data("kendoGrid").dataSource = new kendo.data.DataSource({ data: result });
in yourpost success
As far as I understand you need refresh your kendo grid after a successful update (equivalent to $.ajax
success:
callback) right?In that case kendo grid doesn't have any success callback, instead they use a
complete
callback. Try the following in the transport;Try using
OR