Hi,
I would like to handle saveChanges on grid myself as I want to send additional data to server. So far, this is what I have done:
My concern now is, after I save changes on the server, how to update the DataSource locally so that if reflects no changes and that all changes saved?
More or less, I want to call "sync()", but would that update the datasource locally?
Thanks
I would like to handle saveChanges on grid myself as I want to send additional data to server. So far, this is what I have done:
var allData = stateMap.projectStaffDs.data(); var models = $.grep(allData, function (item) { // grab only dirty rows return item.dirty; }); // save var xhr = $.ajax({ type: "POST", cache: false, url: document.getBaseUrl() + "/Services/SaveStaff", contentType: "application/json; charset=utf-8", dataType: "json", data: JSON.stringify({ data: models, workspace: stateMap.userWorkspace.workspaceName }), success: function(data) { console.log("project staff saved"); $.Topic("spa-notification").publish(spa.util.makeLogItem("success", "Successfully saved!")); $.Topic("project-staff-changed").publish( stateMap. ); }, beforeSend: function(xhr) {}, error: function (xhr, textStatus, errorThrown) { console.log(errorThrown); $.Topic("spa-notification").publish(spa.util.makeLogItem("error", "Failed to save data!")); } });My concern now is, after I save changes on the server, how to update the DataSource locally so that if reflects no changes and that all changes saved?
More or less, I want to call "sync()", but would that update the datasource locally?
Thanks