javascript - Get TH of a TD in Datatables -
how can th of td in datatables? right have code can use add attribute td's on datatable:
"fnrowcallback": function( nrow, adata, idisplayindex, idisplayindexfull) { $('td', nrow).attr("title","pummm"); //takes tds row , assigned title attribute }
what want put different attribute depending on header particular td have.
do mean this? sorry, dont know plugin...
var columnumber = 0; "fnrowcallback": function( nrow, adata, idisplayindex, idisplayindexfull) { $('td, th', nrow).each(function(){ var $this = $(this); if($this[0].tagname == "td"){ switch(columnnumber) { case 0: $this.attr("title","column 0"); break; case 1: $this.attr("title","column 1"); break; . . . . } columnnumber++; } }); }
Comments
Post a Comment