有关如何在 php 中加载和保存数据的示例,请查看以下内容:
http://docs.webix.com/desktop__custom_serverside.html#dataloading
http://docs.webix.com/desktop__dataconnector.html
http://docs.webix.com/samples/14_dataprocessor/08_custom_urls.html
对于使用 webix 的 javascript 端,您可以致电 save
dtable = new webix.ui({
container:"test",
view:"datatable",
editable: true
columns:[
{ id:"id", header:"Id", width:80},
{ id:"name", header:"Name", width:100},
{ id:"email", header:"Email", width:100}
],
url: "data/data_load.php",
datatype:"json" //can be omitted if json.
save: {
"insert":"data/data_insert.php",
"update":"data/data_update.php",
"delete":"data/data_delete.php"
}
});
Here's a working example 在重新排序时调用 save(检查源代码和调用 datatable_order_save.php 的 POST 请求)。
或者您可以使用onAfterEditStop 结合一些ajax 帖子,如果更新失败,您应该可以忽略。
on: {
onAfterEditStop: function(state, editor, ignoreUpdate){
if(state.value != state.old){
// some $ajax() post to update values
}
}
}
我希望这会有所帮助。