如何使用 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>
这是我的ajax
<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>