I am currently using angular-datatables along with promises and everything is working smoothly. I have various actions that can be performed on each record (using angular $http resource) such as changing a status or similar tasks.
However, I find that I need to reload the datatable's data after every action, even if I have only edited one line. This process tends to take a bit longer than desired!
Is there a way to reload only the data that has been changed? For instance, if I make changes to a specific line of data, I would like only that particular line to be reloaded.
Apologies if this sounds like a basic question, but I'm interested in enhancing the performance of actions carried out on the table.
Below is my code snippet:
DtOptions
vm.dtOptions = DTOptionsBuilder.fromFnPromise(function() {
vm.defer = $q.defer();
vm.mainService.getItems(idtask, flag, type).then(function(result)
vm.defer.resolve(result.data);
});
return vm.defer.promise;
})
.withOption('headerCallback', function(header) {
if (!vm.headerCompiled) {
vm.headerCompiled = true;
$compile(angular.element(header).contents())($scope);
}
})
.withPaginationType('full_numbers')
.withOption('createdRow', createdRow)
.withOption('deferRender', true)
.withDisplayLength(100)
.withOption('initComplete', function() { });
ReloadData function
function reloadData() {
var resetPaging = false;
vm.dtInstance.reloadData(function callback() {}, resetPaging);
}
Once I perform some operations on the table, I call the `reloadData()` function.
Thank you for any assistance! And please excuse any mistakes in my English.