Get header columns (also hidden)
Get header columns (also hidden)
tobiascapin
Posts: 1Questions: 0Answers: 0
Hi, I'm using this example: http://www.datatables.net/release-datatables/examples/api/row_details.html to add a details panel. I would like to get the header's labels to build automatically key-val couples.
I found oTable.fnGetData() but this doesn't work for header and, moreover, I can not use the dom inspection $("#table thead th") because if I hide some columns I lose that header. How to solve? Surely datatables has this informations inside its data.
Thanks
I found oTable.fnGetData() but this doesn't work for header and, moreover, I can not use the dom inspection $("#table thead th") because if I hide some columns I lose that header. How to solve? Surely datatables has this informations inside its data.
Thanks
This discussion has been closed.
Replies
1. you could use `fnSettings().aoColumns[i].sTitle` to get the title for column `i` - not really recommended since the settings object might change between versions
2. Use DataTables 1.10, which is pre-beta. It does present this information via the API:
[code]
var table = $('#example').DataTable(); // note the capital D
table.column( i ).header(); // gives the TH/TD cell for column i from which you can get the content
[/code]
I might add a `column().title()` API method into 1.10 thinking about it...
Allan