简体   繁体   English

如何在php中重新加载或刷新treeTable中的数据

[英]how to reload or refresh data in treeTable in php

i have issue on use treeTable while reload data and after save and update data form我在重新加载数据以及保存和更新数据表单后使用 treeTable 时遇到问题

$(document).ready(function() {
    const datajson = <?php echo $data_json  ?>;
    $('#tablejson').treeTable({

        "data": datajson,
        "collapsed": true,
        "responsive": true,
        "lengthChange": true,
        "autoWidth": false,
        "fnDrawCallback": function() {
            $('[data-toggle="tooltip"]').tooltip();
        },
        "aLengthMenu": [
            [10, 50, 100, -1],
            [10, 50, 100, "All"]
        ],
        "iDisplayLength": 10,
        "columns": [{
                "data": "nama_module",
            },
            {
                "data": "controller",
            },
            {
                "data": "function",

            },
            {
                "data": "nm_group",

            },
            {
                "data": "label",

            },
            {
                "data": "btn"
            }
        ],
        "order": [],
    });

    $('#btn-reload').click(function() {
        $('#tablejson').dataTable().api().ajax.reload();
    });
});

i try to click button for reload tabel use $('#tablejson').dataTable().api().ajax.reload();我尝试单击按钮重新加载表格使用$('#tablejson').dataTable().api().ajax.reload(); but not working, this is happen while i use treeTable, if i use datatable only its work for reload or refresh table.但不起作用,这是在我使用 treeTable 时发生的,如果我使用数据表仅用于重新加载或刷新表。

does anyone have the same case with me ?有人和我有同样的情况吗? thanks谢谢

finally, i found a solution in my case, i use code like this最后,我找到了一个解决方案,我使用这样的代码

 $('#btn-reload').click(function() {
        $('#tablejson').DataTable()
            .order([2, 'desc'])
            .draw();
    });

thanks....谢谢....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM