Documentation
Intermediate

REST Mode Support

Webix features full support for REST load and save protocol.

To enter REST mode, use prefix rest before load and save scripts. This will enable the necessary proxy object.

{
    view:"datatable",
    ..config..
    save: "rest->server/datatable_rest.php",
    url: "rest->server/datatable.php"
}

Related sample:  Datatable: REST

You can as well init REST proxy object and set is as value of url and save properties. For these needs webix.proxy() function receives rest prefix and path to your serverside save script.

var rest = webix.proxy("rest", "server/datatable_rest.php");

REST Load and Save Pattern

  • On loading GET request is executed and data in any of supported data formats is returned;
  • When editing happens or update() method is called - PUT request is generated, item ID and other params are sent to the script. Item ID is shown in the address line;
  • When item is added inside the component - POST request is generated, item ID and other params are sent to the script. Item ID is shown in the address line;
  • When item is removed from th component - DELETE request is generated, item ID is sent to the script.

Save script treats adding, editing and deleting operations separately and should contain different code on the base of request method.

Serverside Response

Serverside response is set like with any custom script.

Note that Webix DataProcessor can be tuned to update client-side data from response automatically:

view:"datatable",
save: {
    url:"rest->server/datatable_rest.php",
    autoupdate:true
}
Back to top