Getting content from hidden table header cells

Getting content from hidden table header cells

eeroeero Posts: 2Questions: 0Answers: 0
edited February 2011 in General
Hi all,

I'm using the DataTables hidden row details feature (http://datatables.net/examples/api/row_details.html). In addition, I'm using fnSetColumnVis API function to hide certain columns from the table.

Now, the example on the example page shows how to fetch content from table body rows by using the aData array, and this also works fine for table cells in hidden columns. However, I'd also like to fetch content from the table *headers* of hidden columns, too, but I haven't managed to figure out a way to do this.

The resulting code might look something like this, it it clarifies the issue:

[code]
var sOut = '';
sOut += ''+aHeader[1]+''+aData[1]+'';
sOut += ''+aHeader[2]+''+aData[2]+'';
sOut += ''+aHeader[3]+''+aData[3]+'';
sOut += '';

return sOut;
[/code]

The solution might be very simple and I'm just missing something here, of course. :)

Any help would be greatly appreciated!

Replies

  • eeroeero Posts: 2Questions: 0Answers: 0
    Never mind, I found the solution here: http://datatables.net/forums/comments.php?DiscussionID=3000

    Sorry for the false alarm; I really tried searching for a solution before posting this message, but only now did I manage to conjure the correct search terms that lead me to that thread.

    In case anyone is interested, the relevant code now looks like this:

    [code]
    var sOut = '';
    sOut += ''+oTable.fnSettings().aoColumns[aData.length-4].nTh.innerHTML+''+aData[aData.length-4]+'';
    sOut += ''+oTable.fnSettings().aoColumns[aData.length-3].nTh.innerHTML+''+aData[aData.length-3]+'';
    sOut += ''+oTable.fnSettings().aoColumns[aData.length-2].nTh.innerHTML+''+aData[aData.length-2]+'';
    sOut += ''+oTable.fnSettings().aoColumns[aData.length-1].nTh.innerHTML+''+aData[aData.length-1]+'';
    sOut += '';

    return sOut;
    [/code]

    Thanks to Allan for a fantastic plug-in in any case!
This discussion has been closed.