Serverside integration is possible with Webix data components, client-side datastores (called Data Collections) and forms. It is enabled in several ways:
Basic client-side code that enables loading data to a component during its initialization is as follows:
webix.ui({
id:"dtable",
view:"datatable",
url:"data.php"
});
Or, to load data after component init, apply load() method to it:
$$("dtable").load("myscript.php", "xml");
Note that
More info about custom scripts is in the dedicated article.
If you are unsure what to do in case you need to get data from a different domain with relations to your app's one, consult the our solution to cross-domain data loading.
Basic client-side code that enables data saving from a component to database is as follows:
webix.ui({
id:"dtable",
view:"datatable",
save:"save_script.php"
});
Note that
In addition, save property automatically initializes DataProcessor for this component so that data changes are transmitted to your save script. DataProcessor listens to component events, defines editing operation (as insert, update and delete one) and sends changed data to server script in POST request.
Defining Operation Type
By default, operation status comes as webix_operation in POST request. Usually, save script is single and contains patterns for different operations.
At the same time you can define a specific script for each operation. Dataprocessor will define the type of operation and the necessary script will be executed:
save:{
"insert":"data/insert.php",
"update":"data/update.php",
"delete":"data/delete.php"
}
Related sample: Server-side Integration: Custom URL
If you need to change the default pattern of data processing - look up Dataprocessor docs;
If you use Webix Uploader, you may wonder about how saving of the files is performed.
{
view:"uploader",
id:""uploader1,
name:"uploader"
upload:"upload.php"
autosend:false
}
$$("uploader1").send();
Note that
Form data is either