可以'在sails.js+angularjs项目中无法使DataTables响应

Can't get DataTables responsive working in sails.js + angularjs project

本文关键字:响应 DataTables 项目 js+angularjs sails 可以      更新时间:2023-09-26

我已经导入了必要的DataTables css和js文件。

<link rel="stylesheet" href="/bower_components/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.css">
<script src="/js/dependencies/sails.io.js"></script>
<script src="/js/dependencies/angular.js"></script>
<script src="/js/dependencies/angular-route.min.js"></script>
<script src="/bower_components/angular-bootstrap/ui-bootstrap.min.js"></script>
<script src="/bower_components/jquery/dist/jquery.min.js"></script>
<script src="/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>

我尝试添加一个js文件:

$(document).ready(function() {
        $('#userListTable').DataTable({
                responsive: true
        });
    });

不起作用。

我已经尝试在表html中添加responsive,但仍然不起作用:

<div class="dataTable_wrapper" ng-controller="UserCtrl">
    <table class="table display responsive no-wrap table-striped table-bordered table-hover" id="userListTable">
    </table>
</div>

那么,我如何让DataTables responsive在sails+Angular.js项目中工作呢?

两件事:

  1. 我建议使用bower模块数据表.net提供的
  2. 当使用带有引导程序样式的dataTables时,responsive通常不起作用。尝试"dt responsible",因为"在Bootstrap中,responsible类用于执行表的滚动"-datatables.net responsible