save

defines a path to the server to save cell changes to

string|object save;

Example

webix.ui({
  view:"spreadsheet",
  url: "server/get.php",
  save: {
    data:"server/data.php", // if data are changed
    sizes:"server/sizes.php", // if the sizes of cells are changed
    spans:"server/spans.php", // if cells are merged or split
    styles:"server/styles.php" // if styles are changed or a new one created
  }
});

Related samples

Details

When cell content is changed, a POST request is issued and sent to the server specified by the save property. In case of multiple cells being changed you can send a corresponding number of requests as in the example above.

You can also send requests to handlers in one common request:

webix.ui({
  view:"spreadsheet",
  url: "server/get.php",
  save:"/server" 
});

In this case, paths to the necessary handlers will be added automatically:

  • data => /server/data
  • styles => /server/styles
  • sizes => /server/sizes
  • spans => /server/spans

Instead of URLs, you can pass a function with parameters name and data to data/sizes/spans/styles:

webix.ui({
  view:"spreadsheet",
  ...
  save: {
    data: save,
    sizes: save,
    spans: save,
    styles: save
  }
});
 
function save(name, data){
  webix.ajax().post(name, data).fail(function(err){
    webix.message({
      type: "error",
      text: `Spreadsheet save ${name} error`
    });
  });
}

Saving Data and State

You can save to the server not only data, but also the current state of the spreadsheet. For this, enable the automatic saving mode by setting the all property of save:

webix.ui({
  view:"spreadsheet",
  url: "server/get.php",
  save: {
    all:"/server/sheets/1"
  }
});

If the all property is specified the widget sends a serialized data to the specified path.

See also
Back to top