我用angular datatables with fixed column,用於查看下面的我的HTML代碼:角數據表固定列不確定是不是一個函數
<div class="row" ng-controller="PerformanceCtrl">
<table id="example" datatable=""
class="stripe row-border order-column"
dt-options="dtOptions">
<thead>
<tr>
<th>First name</th>
<th>Last name</th>
</tr>
</thead>
<tbody>
<tr>
<td>Tiger</td>
<td>Nixon</td>
</tr>
</tbody>
</table>
我的控制器代碼如下所示:
'use strict';
app.controller('PerformanceCtrl', ['$scope', 'DTOptionsBuilder', 'DTColumnDefBuilder', function ($scope, DTOptionsBuilder, DTColumnDefBuilder) {
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('scrollY', '300px')
.withOption('scrollX', '100%')
.withOption('scrollCollapse', true)
.withOption('paging', false)
.withFixedColumns({
leftColumns: 1
});
}]);
而對於我index.html
文件,我按照以下順序包括數據表庫:
<script src="bower_components/jquery/dist/jquery.min.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="modules/performance/controller.js"></script>
<link rel="stylesheet" href="bower_components/angular-datatables/dist/plugins/bootstrap/datatables.bootstrap.css">
<script src="bower_components/DataTables/media/js/jquery.dataTables.js"></script>
<script src="bower_components/angular-datatables/dist/angular-datatables.min.js"></script>
<script src="bower_components/angular-datatables/dist/plugins/fixedheader/angular-datatables.fixedheader.min.js"></script>
<script src="bower_components/angular-datatables/dist/plugins/fixedcolumns/angular-datatables.fixedcolumns.min.js"></script>
<link rel="stylesheet" type="text/css" href="bower_components/DataTables/media/css/jquery.dataTables.min.css">
而且這是我的模塊:
var app = angular.module('MyApp', ['datatables', 'datatables.fixedcolumns']);
但我得到這個錯誤undefined is not a function
爲這一形象:
如果我從表中,沒有錯誤的選項去掉下面的代碼,但沒有fixedColumns:
.withFixedColumns({
leftColumns: 1
});
我需要修正我的第一列,我該如何解決這個錯誤?
請檢查此; ine'angular.module('showcase.withFixedColumns',['datatables','datatables.fixedcolumns'])''。你有注入這個'datatables.fixedcolumns''嗎? –
@RameshRajendran是的,我注入了它,我在問題 –
中添加我的模塊我想我已經通過我的答案來處理您的問題。請讓我知道,如果你有疑問 –