DataTables-Hide-Empty-Columns
DataTables-Hide-Empty-Columns copied to clipboard
Does perPage work with AJAX data?
Just found this and I've been trying to make this work with my table that get its data using AJAX.
It appears to hide the columns when they're empty but the columns don't come back if I navigate back to a page where they're not empty.
For the columns to show again I have to refresh the page.
I've copied the bit from the example for perPage the only difference seems to be that I'm loading the data with AJAX instead of it already being on the page.
Is there something I could have missed?
Here's how I've created the table if it's any help:
$(document).ready(function () {
var oTable = $('#e-table').dataTable({
columns: [
{title: "Name"},
{title: "Serial Number"},
// Some more columns generated by PHP
],
serverSide: true,
"bInfo": false,
"bLengthChange": false,
"pageLength": 15,
"oLanguage": {
"sZeroRecords": "Nothing to display",
"sSearch": ""
},
hideEmptyCols: {
columns: <?php echo $columnsToHide; ?>,
perPage: true
},
"ajax": '/ajax_table/'
});
});
The data returned from /ajax_table/ is just as the dataTables spec says it should be.
Hey Mike,
Thanks for using the plugin and opening the ticket, and I apologize for the response delay. I had to take a break from personal projects like this, due to the demands in my professional career.
I will work on this and see whats causing the issue, then update you asap!
No probs! If there's anything else you need from me, let me know.
There's no big rush for it, it's a 'nice to have' :)
Nobody handled that so far?
@mikeee324 I just merged the pull request from @AlexeyKosov, and committed an example of a datatable using an ajax source and this plugin. Let me know if you have any other questions/issues