我用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是的,我注入了它,我在问题 –
中添加我的模块我想我已经通过我的答案来处理您的问题。请让我知道,如果你有疑问 –