waitSave
allows to catch the moment when a data operation was saved to the server
function waitSave( // one or several data operations handler: function): promise
Returns
Section titled “Returns”promise
a promise that resolves if all operations were saved successfully and rejects if at least one failed
Example
Section titled “Example”const grid = webix.grid({ save:"/some/path", // ...other config});
grid.waitSave(function(){ this.add({ rank:99, title:"", year:"2012", votes:"100" });}).then(function(obj){ grid.select(obj.id);});
Details
Section titled “Details”this inside of the handler function points to the data component.
waitSave will work only if saving is enabled, i.e. if you set the way to save data to the server.
If the handler contains one data operation, the returned promise resolves with an object. For example, for an add operation, the object can contain the new server-side ID for the new record.
If the handler contains several data operations, the promise returns an array of objects for each data operation:
grid.waitSave(function(){ for (var i = 0; i < 3; i++){ this.add({ rank:99, title:"", year:"2012", votes:"100" }); }}).then(function(arr){ for (var i = 0; i < arr.length; i++){ grid.select(arr[i].id, i); }});