Currently, I am facing an issue with angular-datatables while implementing server-side processing. It seems that sorting on columns is not working as expected.
Here is the structure of my HTML code:
<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>
In the corresponding controller, this is how my JS looks like:
$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)
];
If anyone has encountered a similar problem or knows what might be causing this issue, your insights would be greatly appreciated.