如何在adminlte中使用datatables插件?我已尝试在默认页面datatables adminlte上进行匹配,但它不起作用。 这是我的代码
<table id="example2" class="table table-bordered table-hover">
<thead>
<tr>
<th>Rendering engine</th>
<th>Browser</th>
</tr>
</thead>
<tbody>
<tr>
<td>Trident</td>
<td>InternetExplorer 4.0</td>
</tr>
</tbody>
</table>
和scrypt
<!-- DataTables -->
<script src="{{ URL::asset('assets/plugins/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ URL::asset('assets/plugins/datatables/dataTables.bootstrap.min.js') }}"></script>
<link rel="stylesheet" href="{{ URL::asset('assets/plugins/datatables/dataTables.bootstrap.css') }}">
请帮助我,我不知道为什么数据表无法正常工作,在控制台中没有错误。顺便说一句,我使用laravel 5.3和AdminLTE-2.3.0
pagescrypt
<script>
$(function () {
$("#example1").DataTable();
$('#example2').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false
});
});
</script>
答案 0 :(得分:0)
首先,您需要删除tbody标签 就像这样:
$('#example2').DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
columns:[{'data':'data','name':'name'}]});
我建议看一下这个tutorail: https://appdividend.com/2018/04/16/laravel-datatables-tutorial-with-example/