【发布时间】:2020-09-19 07:46:08
【问题描述】:
在 laravel 6 应用程序中,我使用“yajra/laravel-datatables-oracle”:“^9.4”,我需要选择 1 行并在服务器上运行 ajax 请求以删除该行 我尝试使用 draw() 方法刷新表格,但它不起作用。
在我的刀片文件中:
@push('scripts')
var oTable;
$(document).ready(function () {
oTable = $('#my_tasks_data').DataTable({
processing: true,
serverSide: false,
info: false,
order: [],
});
$('div.dataTables_length select').select2({
theme: "bootstrap"
});
...
function taskComplete(rowId) {
$.ajax({
url: 'tasks/' + rowId + '/complete',
type: "post",
dataType: 'json',
data: {'_token': '{{csrf_token()}}'},
success: function (data) {
console.log('taskComplete success data::')
console.log(data)
console.log('oTable::')
console.log(oTable)
oTable.draw(); // THat does not work
alert( 'AFTER::' )
},
error: function (xhr) {
console.error(xhr)
}
});
}
我检查了 oTable var 并看到:https://prnt.sc/ujyp14 它看起来像有效的 Table 对象
为什么它不起作用以及如何解决?
谢谢!
【问题讨论】:
标签: javascript laravel laravel-datatables