I've successfully set up my angular datatable configuration. Here's what it looks like:
vm.dtOptions = DTOptionsBuilder.newOptions().
withPaginationType('full_numbers').
//withOption('ajax', {
// url: 'rest/get/'+entityName,
// type: 'GET'
//}).
withOption('serverSide', true).
withOption('ajax', function(data, callback, settings) {
EntityManager.get({entity:entityName,action:'get',start:data.start,length:data.length}).$promise.then(function(response) {
console.log('response');
console.log(response);
vm.objectList = response.data;
callback({
recordsTotal: response.recordsTotal,
recordsFiltered: response.recordsFiltered,
data: response.data
});
});
}).
withDataProp('data').
withOption('processing', true).
withOption('bFilter', false).
withOption('bSort', false).
withOption("aaSorting", []).
withDisplayLength(10);
However, I'm encountering an issue with the filtering function. It updates the data and recordsTotal
, but the pagination doesn't get re-rendered - specifically, the last button number isn't modified as expected. Is there a way to trigger the following code block from the controller?
callback({
recordsTotal: response.recordsTotal,
recordsFiltered: response.recordsFiltered,
data: response.data
});
Which objects and methods are responsible for updating the pagination in this context?