Having trouble with createdCell
Having trouble with createdCell

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:
Not able to access the column <th> element from this td
Here is the code snippet
columns.push( {
'title':'<div data-max='+ max +' data-min='+ min +' data-clr='+ clr +'>'+header_name+'</div>',
"render":{
display: function(data, type, row){
...
}
},
'createdCell' : function (td, cellData, rowData, row, col) {
//I have data attributes attached to specific column header
//Not able to access the column <th> element from this td
var alpha = (cellData-min)/(max-min)*(255-20) + 20;
$(td).css('background-color', clr);
$(td).css('opacity', alpha);
}
});
This discussion has been closed.
Answers
col
is the column number - so you would use this to query the header to get theth
,Colin
Table thead & tbody is not populated yet. And $(td).parent() gives tr.
How to get the div inside thead?
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin