我有以下代码,我想在删除记录后刷新数据表。目前我必须手动刷新浏览器......我该怎么办?
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
var oTable = $('#example').dataTable({
"bProcessing": false,
"bServerSide": true,
"sAjaxSource": "server_processing.php",
"aoColumns": [{
"bVisible": true
}, {}, {}, {}, {}]
}).makeEditable({
sUpdateURL: function (value, settings) {
console.log(value, settings);
oTable.fnDraw();
return (value); //Simulation of server-side response using a callback function
},
sDeleteURL: "DeleteData.php",
"aoColumns": [{
cssclass: 'required'
}, {
indicator: 'Saving platforms...',
tooltip: 'Click to edit platforms',
type: 'textarea',
submit: 'Save changes'
}, {
indicator: 'Saving Engine Version...',
tooltip: 'Click to select engine version',
loadtext: 'loading...',
type: 'select',
onblur: 'cancel',
submit: 'Ok',
loadurl: 'EngineVersionList.php',
loadtype: 'GET'
}, {
indicator: 'Saving CSS Grade...',
tooltip: 'Click to select CSS Grade',
loadtext: 'loading...',
type: 'select',
onblur: 'submit',
data: "{'':'Please select...', 'A':'A','B':'B','C':'C'}"
}]
});
});
</script>
答案 0 :(得分:0)
可以完成任何事情,包括从脚本级别自动重新加载页面,运行将获取新数据的AJAX脚本,以及重新填充表格。要仅操作表本身并删除行,如果您当前要从后端的数据库或数据集中删除它,那么它将在下一次加载时再次显示在前端,只需删除整个暂时视觉上排列将是完美的。但还有其他战术要做。这一切都取决于后端的最新情况,当前如何喂你的餐桌等。