我无法使用绘制方法刷新yajra / laravel-datatables-oracle中的数据

问题描述

在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对象

为什么它不起作用以及如何解决?

谢谢!

解决方法

我发现将serverSide属性设置为true的决定

oTable = $('#my_tasks_data').DataTable({
    processing: true,serverSide: true,

然后使用oTable.draw()方法就可以了

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...