allows to catch the moment when a data operation was saved to the server

promise waitSave(function handler);


handlerfunctionone or several data operations


promisea promise that resolves if all operations were saved successfully and rejects if at least one failed


    // ...other config
        type:"folder", value:'New folder', date: "2014-02-10 16:10"
    }, null, "documents");


this inside of the handler function points to the data component.

waitSave will work only if the component has a DataProcessor, 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:

    for (var i = 0; i < 3; i++){
        this.add({ rank:99, title:"", year:"2012", votes:"100" });
    for (var i = 0; i < arr.length; i++){
        $$("grid").select(arr[i].id, i);

waitSave stably works with if DataProcessor is enabled for the component and its autoupdate setting is not modified.

Back to top