【问题标题】:how to use datatables plugin in laravel如何在 laravel 中使用数据表插件
【发布时间】:2018-01-21 15:08:43
【问题描述】:

如何在 adminlte 中使用数据表插件?我已经在默认页面数据表 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>

还有密码

<!-- 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>

【问题讨论】:

    标签: jquery laravel datatables adminlte


    【解决方案1】:

    首先你需要删除 tbody 标签 这应该是这样的:

            $('#example2').DataTable({
      "paging": true,
      "lengthChange": false,
      "searching": false,
      "ordering": true,
      "info": true,
      "autoWidth": false,
    columns:[{'data':'data','name':'name'}]});
    

    我建议看看这个教程: https://appdividend.com/2018/04/16/laravel-datatables-tutorial-with-example/

    【讨论】:

      猜你喜欢
      • 2015-02-26
      • 1970-01-01
      • 2020-03-31
      • 2023-03-14
      • 2023-01-28
      • 2012-03-19
      • 1970-01-01
      • 2017-04-18
      • 1970-01-01
      相关资源
      最近更新 更多