Hi, I don’t understand the difference between a DataCollection and a DataProcessor. According to this: https://docs.webix.com/desktop__nonui_objects.html#serversideintegrationwithnonuicomponents
If I define a DataCollection, I don’t need a DataProcessor, right?
But I’m not getting the server side save operation to fire from the DataCollection when the .add function is called.
I’m using this example: https://docs.webix.com/samples/40_serverside/01_php/08_datastore.html
My code is as follows:
var store = new webix.DataCollection({
url:"server/datatable.php",
save:"server/datatable_save.php"
});
var grida = webix.ui({
container:"grida",
id: "grid1",
view:"datatable",
columns:[
{ id:"rank", header:"", css:"rank", width:50},
{ id:"title", header:"Film title", width:200},
{ id:"year", header:"Released", width:80},
{ id:"votes", header:"Votes", width:100}
],
autoheight:true,
autowidth:true,
select:"row"
});
grida.sync(store);
var forma = webix.ui({
container:"forma",
view:"form",
id:"form1",
width:350,
scroll:false,
elements:[
{ view:"text", name:"title", label:"Title" },
{ view:"textarea", name:"year", label:"Year" },
{ view:"textarea", name:"votes", label:"Votes" },
{ view:"button", value:"Cancel",
click:function() {
var grid = $$("grid1");
var id = grid.getSelectedId();
if (id) {
var values = grid.getItem(id);
var form = $$("form1");
form.setValues(values);
}
}
},
{ view:"button", value:"Save",
click:function() {
var form = $$("form1");
var data = form.getValues();
var grid = $$("grid1");
console.log("data: " + JSON.stringify(data));
if (data.id) {
console.log("update called.");
grid.updateItem(data.id, data);
} else {
console.log("add called.");
grid.add(data);
}
form.clear();
}
}
]
});
forma.bind(grida);
If you watch the network traffic, when you add an item, it never calls the save function. It does for the update, but not for add. Any idea why?
Thanks, Dan