How to get column information
How to get column information
peterkronenberg
Posts: 112Questions: 0Answers: 0
If I have an element that I know is in row n, how can I get the column name and/or and pointer to the column element? fnGetData and fnGetNodes only return data rows. I thought perhaps Row 0 would be the header info.
This discussion has been closed.
Replies
Allan
$('#table_id thead th:eq('+c+')').html();
[/code]
Just a DOM query will do it - no need for DataTables to provide an API function for it.
Allan
Any thoughts on this? FixedHeader doubles the number of columns because of the way it's defined.
Also, using the DOM doesn't work if I have hidden columns using ColVis. How can I obtain a list of all the columns, hidden or not?
For the ID issue - I'm surprised at what happened there as well, but obviously FixedHeader should be removing the ID. I've just committed a fix and you can grab the nightly version which has this in it.
Allan
Would fnSettings().nTHead also provide me with similar information?
For fnGetData - the array it returns is the data for all columns, regardless of if they are hidden or not.
Allan
The plug-in API function fnGetTd ( http://datatables.net/plug-ins/api#fnGetTd ) can be used to get a full list of TD elements for a row.
Allan
I think this is definitely a bug. Even when I unhide a column, the classes that were specified in aoColumnDef are not being applied. They appear to be ok in the elements, but not in the .
This only happens to columns that are hidden at initialization, with bVisible.
Allan
Still having the problem with nodes returned by fnSettings().aoColumns[].nTh not having the classes applied for hidden columns
Allan