繁体   English   中英

如何在Api jQuery DataTables中创建删除按钮?

[英]How to create delete button in Api jQuery DataTables?

如何使用jQuery DataTables API添加删除按钮? 我能够安装数据表,但是无法实现这些方法。

有人能帮我吗 ?

https://github.com/yajra/laravel-datatables#jquery-datatables-api-for-laravel-45

这是我的控制器

 public function getIndex()
{
    return view('usuarios');
}

public function anyData()
{
    return datatables()->eloquent(mytable::query())->make(true);

}

这是我的blade.php

    <table id="users-table" class="table table-bordered">
     <thead>
        <tr>
        <th>data_1</th>
        <th>data_2</th>
        <th>data_3/th>
        <th>data_4</th>
        <th>data_5</th>
        <th>data_6</th>
        <th>data_7</th>
        <th>data_8</th>
        </tr>
    </thead>


    </div>

这是我的阿贾克斯

<script>
$(function() {
    $('#users-table').DataTable({
        processing: true,
        serverSide: true,
        ajax: 'localhost/anyData',
        columns : [
            {data: 'data_1'},
            {data: 'data_2'},
            {data: 'data_3'},
            {data: 'data_4'},
            {data: 'data_5'},
            {data: 'data_6'},
            {data: 'data_7'},
            {data: 'data_8'}

        ]
    });
});

</script>

DataTables文档显示了有关如何通过单击行内的图标来删除行的示例。

另外,似乎<table>元素未正确关闭。

暂无
暂无

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

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