【发布时间】:2015-07-10 20:13:46
【问题描述】:
我将 angular-datatables 与服务器端处理一起使用,它不允许我对列执行排序。
这是我的 HTML:
<table class="table table-striped table-bordered" datatable="" dt-column-defs="dtColumnDefs" dt-options="dtOptions">
<thead>
<tr>
<th translate>NAME</th>
<th translate>BASIC_UNIT</th>
<th translate>STATUS</th>
</tr>
</thead>
</table>
这是我在相应控制器中的JS:
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withBootstrap()
.withOption('order', [0, 'asc'])
.withOption('ajax', {
url: 'path/to/server/resource',
type: 'POST'
})
.withDataProp('data')
.withOption('processing', true)
.withOption('serverSide', true)
.withPaginationType('full_numbers');
$scope.dtColumnDefs = [
DTColumnDefBuilder.newColumnDef(0)
.withOption('sName', 'name')
DTColumnDefBuilder.newColumnDef(1)
.withOption('sName', 'basic_unit')
.withOption('bSearchable', false)
.withOption('bSortable', false),
DTColumnDefBuilder.newColumnDef(2)
.withOption('sName', 'status')
.withOption('bSearchable', false)
.withOption('bSortable', false)
];
有人知道我是否遗漏了什么吗?
【问题讨论】:
标签: javascript angularjs datatables