How change dynamically title of column
How change dynamically title of column
pipo75
Posts: 14Questions: 7Answers: 0
I would like to change text of a column title after table had benn rendered , do you know if I czan do sometjing like that:
table = $('#example').DataTable({
"data": source_dataTable,
"columnDefs": defs,
"dom": 't<"top"f>rt<"bottom"lpi><"clear">',
});
// WHAT I WANT TO DO:
table.column(0).title.text("new title for the column 0");
do you know if it is possible?
This question has accepted answers - jump to:
This discussion has been closed.
Answers
$( table.column( 0 ).header() ).text( 'My title' );
should do it.That uses
column().header()
to get the column header cell.Allan
thank you but it doesn't work and link is dead :(
see https://datatables.net/reference/api/column().header()
instead of https://datatables.net/reference/options/column().header() (no good)
Sorry - link fixed now.
At last answere is :
var head_item = table.columns(1).header();
$(head_item ).html('new header');