Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var grid = $("#grid").getKendoGrid();
- grid.bind("saveChanges", function (e) {
- var data = grid.dataSource.data();
- // collect updated rows and new rows
- var items = $.grep(data, function (item) {
- return item.dirty || item.id === 0;
- })
- // collect deleted rows
- $.each(grid.dataSource._destroyed, function (index, item) {
- item.IsDeleted = true;
- items.push(item);
- })
- $.ajax({
- type: "POST",
- data: items,
- url: "save",
- contentType: "application/json; charset=utf-8",
- processData: true,
- cache: false,
- })
- .done(function (response, textStatus, jqXHR) {
- // do something
- })
- .fail(function (jqXHR, textStatus, errorThrown) {
- // How do i inform datasource or grid about error
- })
- })
Add Comment
Please, Sign In to add comment