Datatable server side how to get all data in a specific coloumn across pages?
Datatable server side how to get all data in a specific coloumn across pages?
odf18
Posts: 3Questions: 2Answers: 0
I want get all the ids in my check box coloumn when I click on. I've managed to get the total data row count, but I couldnt find a way to fetch all data of that coloumn with all pages. I'm using serverside processing
Below is my code
$(".check-all input[type=checkbox]").change(function() {
if($(this).is(":checked")) {
console.log(thisTable.page.info().recordsTotal);
$('#userTable_info').append(' <a href="">Select all ' + thisTable.page.info().recordsTotal+'</a>');
//this return only current page ??
var data = thisTable.search('').column(0).data();
console.log(data);
}
});
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @odf18 ,
It's not possible to do with
serverSide
enabled. When enabled, the client doesn't have a global view of the data, just what's currently being displayed - this is to optimise the performance, but that lack of a global view is one consideration of when/how to use it.Cheers,
Colin
@colin
'.page.info().recordsTotal' this returns the row count. like wise isn't there any alternative way where I can fetch all data in a specific column via server-side processing. pls advice
or else passing additional parameter here in my model and will it possible to access via ajax?
"draw" => intval($draw),
"recordsTotal" => $total,
"recordsFiltered" => $total,
"columndata'' => $data
);
Yep, the server returns the total number of records in the Ajax response, but there's no way to access the data of those records not being displayed I'm afraid.