Get show/hidden column name
Get show/hidden column name
Hi, first i want to thanks you for the great work you did on Datatable.
I'm quite new with this plug-in and I have a little problem with ColVis.
I can retrieve the data using [code]oTable._('tr', {"filter": "applied"});[/code] but but is there any way to get the column name visible in the th elements?
I'm quite new with this plug-in and I have a little problem with ColVis.
I can retrieve the data using [code]oTable._('tr', {"filter": "applied"});[/code] but but is there any way to get the column name visible in the th elements?
This discussion has been closed.
Replies
Allan
Here the code i've try with the html example given in the download part.
[code]
$(document).ready(function() {
var oTable = $('#example').dataTable({
"sDom": 'C<"clear">lfrtip',
"aoColumns": [
{ "sName": "engine" },
{ "sName": "browser" },
{ "sName": "platform" },
{ "sName": "version" },
{ "sName": "grade" }
]
} );
ColumnsShown = $('#example').getColumnsShown(this);
alert(ColumsShown);
} );
$.fn.getColumnsShown = function(dTable){
var vCols = [];
$.each(dTable.fnSettings().aoColumns, function(c){
if(dTable.fnSettings().aoColumns[c].bVisible === true){
vCols = vCols.concat(dTable.fnSettings().aoColumns[c].sName);
}
});
return vCols;
};
[/code]
Allan
[code]ColumnsShown = $('#example').getColumnsShown(oTable);
alert(ColumnsShown);[/code]
forgot the n ...
Thanks for your answers it' works =).
Now I'm looking on listeners for filtering and hiding columns (Colvis); I want to recover those data when any columns are filtered or hidden, any tips?