I'm trying to set search disable on specific column. Im using this angular datatable server side.
https://l-lin.github.io/angular-datatables
usually on jquery i can just:
columns:[{data:"foo", name:"foo", searchable:false}]
I've tried use:
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('ajax', {
url: apiRoot + 'merchant-list'
})
.withDataProp('data')
.withOption('serverSide', true)
.withOption('order', [0, 'asc'])
$scope.dtColumns = [
DTColumnBuilder.newColumn('name', 'Name'),
DTColumnBuilder.newColumn('type', 'Type'),
DTColumnBuilder.newColumn('username', 'Username'),
]
$scope.dtColumnDefs = [
DTColumnDefBuilder.newColumnDef(0),
DTColumnDefBuilder.newColumnDef(1).withOption('searchable', false),
DTColumnDefBuilder.newColumnDef(2).withOption('searchable', false)
]
seems to work but, the position of columnDef is not correct. when i put newColumnDef(1) searchable to false, the column not to be search should be the second one, but apparently it disable the first column.
Is there way to make it disabled search for specific column and order it?
Thanks
Edit: I've tried 'orderable',false and notvisible is working on columnDef 0. Looks like only searchable is fail.
Both DTColumnBuilder
and DTColumnDefBuilder
items must be declared inside an array :
$scope.dtColumns = [
DTColumnBuilder.newColumn('name', 'Name').withOption('searchable', false)
...
]
And then it works -> http://plnkr.co/edit/OOikiBKdLE8R1UEXLyMH?p=preview
or
$scope.dtColumnDefs = [
DTColumnDefBuilder.newColumnDef('name', 'Name').withOption('searchable', false)
];