I'm trying to make Angularjs Datatable server side pagination in this link https://l-lin.github.io/angular-datatables/#/serverSideProcessing
So I use this code
$scope.dtOptions = DTOptionsBuilder.newOptions()
.withOption('ajax', {
dataSrc: function(json) {
conole.log(json)
json['recordsTotal'] =json.length
json['recordsFiltered'] = json.length
json['draw']=1
conole.log(json)
return json;
},
url: 'api/footestrecords',
type: 'GET'
})
.withOption('processing', true)
.withOption('serverSide', true)
.withPaginationType('full_numbers');
I added recordsTotal, recordsFiltered and row manually in dataSrc parameter
and this is json data before and after add recordsTotal, recordsFiltered and row
json data before add
[Object, Object, Object, Object, Object, Object, Object, Object,
Object,Object, Object, Object, Object, Object, Object, Object, Object,
Object, Object, Object, Object, Object, Object, Object, Object, Object,
Object, Object]
json data after add
[Object, Object, Object, Object, Object, Object, Object, Object,
Object, Object, Object, Object, Object, Object, Object, Object, Object,
Object, Object, Object, Object, Object, Object, Object, Object,
Object,Object, Object, recordsTotal: 28, recordsFiltered: 28, draw: 1]
the probelm is pagination don't work ,data table shows all data in one page,and when I click on paging button did no action.
conole.log
– Andersen