withFixedColumns属性对我来说不适用于使用angular datatable

时间:2015-09-29 21:57:25

标签: angularjs datatables

我正在使用angulardatable。我需要创建一个表并修复第一列。数据表工作正常,但当我添加withFixedColumns时,表格消失了。我已经包含了所有的库。

这是我的代码的一部分



var app = angular.module('dataview', ['datatables', 'datatables.fixedcolumns'])

app.controller('DataViewCtrl', function($scope, DTOptionsBuilder,){
  
  $scope.dtOptions = DTOptionsBuilder.newOptions()
    .withOption('scrollY', '500px')
    .withOption('scrollX', '100%')
    .withOption('paging', false)
    .withOption('scrollCollapse', true)
})

<script src="/assets/vendor/jquery/dist/jquery.min.js"></script>
<script src="/assets/vendor/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="/assets/vendor/angular/angular.min.js"></script>
<script src="/assets/vendor/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="/assets/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script src="/assets/vendor/angular-datatables/dist/angular-datatables.min.js"></script>
<script src="/assets/js/plugins/dataTables/FixedColumns-master/js/dataTables.fixedColumns.js"></script>
<script src="/assets/vendor/angular-datatables/dist/plugins/fixedcolumns/angular-datatables.fixedcolumns.min.js"></script>

<body ng-app="dataview" ng-controller="DataViewCtrl as DVC">
  <table class="table table-striped table-hover" datatable="ng" dt-options="dtOptions">
    <thead>
      <th>Date</th>
      <th ng-repeat='tag_name in tag_names'>{{tag_name}}</th>
    <thead>  
    <tbody>
      <tr ng-repeat='tr in graph_data'>
        <td ng-repeat='td in null2text(tr) track by $index'>{{td}}</td>
      </tr>  
    </tbody>  
  <table>  
</body>  
&#13;
&#13;
&#13;

当我附上withFixedColumns时,它到目前为止工作正常。表消失

这是带错误的代码:

&#13;
&#13;
 $scope.dtOptions = DTOptionsBuilder.newOptions()
    .withOption('scrollY', '500px')
    .withOption('scrollX', '100%')
    .withOption('paging', false)
    .withOption('scrollCollapse', true)
    .withFixedColumns({
            leftColumns: 1
        });
&#13;
&#13;
&#13;

0 个答案:

没有答案