I am trying to add/remove columns depending on what is returned from the server in the ajaxProcessing function. I can see in the pager source that this isn't possible directly.
// only add new header text if the length matches
if ( th && th.length === hl ) {
Is there any workaround to this or should I start tinkering with the code? If I need to make changes, any advice on what to start with? Thanks.
Added this in the ajaxProcessing event and it did the trick.
var headerCount = $('#id thead tr:eq(0) th').length;
var hl = data.headers.length;
if (headerCount < hl) {
for (var i = headerCount; i < hl; i++) {
$('#id thead tr:eq(0)').append('<th>' + data.headers[i] + '</th>');
}
}else if (headerCount > hl) {
for (var i = headerCount - 1; i >= hl; i--) {
$('#id thead tr:eq(0) th:eq(' + i + ')').remove();
}
}
if(headerCount !== hl) $('#id').trigger('updateAll', [false, null]);