在jquery数据表中,我可以禁用特定的列排序依据
"aoColumnDefs": [{ 'bSortable': false,'aTargets': [0,7] }]
任何人都知道如何在角度JS中做到这一点?
<table class="custom-table" datatable="ng" dt-options="dtOptions" id="contacts-list-table"> </table> myApp.controller("ListCtr",['DTOptionsBuilder',function(DTOptionsBuilder) { $scope.dtOptions = DTOptionsBuilder.newOptions().withDOM('C<"clear">lfrtip') }])
角度数据表等价于
原文链接:https://www.f2er.com/angularjs/143451.htmlaoColumnDefs: [{ bSortable: false,aTargets: [0,4] }]
是
$scope.dtColumnDefs = [ DTColumnDefBuilder.newColumnDef(0).notSortable(),DTColumnDefBuilder.newColumnDef(4).notSortable() ];
…
<table class="custom-table" dt-column-defs="dtColumnDefs" datatable="ng" dt-options="dtOptions" id="contacts-list-table"></table>
您必须在控制器中包含DTColumnDefBuilder:
myApp.controller("ListCtr",'DTColumnDefBuilder',function(DTOptionsBuilder,DTColumnDefBuilder) { $scope.dtOptions = DTOptionsBuilder.newOptions().withDOM('C<"clear">lfrtip'); $scope.dtColumnDefs = [ DTColumnDefBuilder.newColumnDef(0).notSortable(),DTColumnDefBuilder.newColumnDef(4).notSortable() ]; } ])