column-visibility function question
column-visibility function question
I have a script that returns the column number or index when I use the built in pop-up with buttons to show/hide columns. Is there a way when I use column-visibility from the built in buttons to get the column header name. Here is the script I am using that retuns the col numbers that I send to a web service to update a datrabase.
var table = $('#example').DataTable({.....
table.on('column-visibility.dt', function (e, settings, column, state) {
var colchanged = column.toString() + ',' + state.toString();
$.ajax({
url: '/Shared/WebServiceHandler.ashx?q=GetDataTable3&s=' + colchanged ,
dataType: 'json',
type: 'POST',
success: function () {}
});
});
Regards
Michael Duclon
Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.
This question has an accepted answers - jump to answer
Answers
I think the way you're doing is probably best. You could over-write the
action
of the visibility button but I suspect that'll be fiddlier,Colin
Thanks Colin, I've come up with a work around.