javascript - Angular datatables Fixed Columns undefined is not a function -
i used angular datatables fixed column, html code view following:
<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>
and controller code following:
'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 }); }]);
and index.html
file, included datatables libraries following order:
<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">
and module:
var app = angular.module('myapp', ['datatables', 'datatables.fixedcolumns']);
but got error undefined not function
image:
if removed following code options of table, no error no fixedcolumns:
.withfixedcolumns({ leftcolumns: 1 });
i need make first column fixed, how can fix error ?
i post question on github, , l-lin answer on it.
i missed including following:
<script src="vendor/fixedcolumns-3.0.4/js/datatables.fixedcolumns.min.js"></script> <link rel="stylesheet" type="text/css" href="vendor/fixedcolumns-3.0.4/css/datatables.fixedcolumns.min.css">
i should download fixcolumns jquery.
Comments
Post a Comment