Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67469

Tablesorter How to update table header values

$
0
0

I am using Motties tablesorter table, which works like a charm. Now I need to update the column headers dynamically and optionally the tables contents. Update the content works fine. How I would update the table header text of a tablesorter table ? This is how I update the table2 contents:

var $table = $('#table2');
$.tablesorter.clearTableBody( $table[0] );
$("#table2 tbody").append(data);
var resort = true;
$("#table2").trigger("update", [resort]);

How would I update the table header only ? I thought I could do this way :

var headers= ["Banana", "Orange", "Apple", "Mango"];
$('table2 thead').html('<tr>' + headers + '</tr>');

but it does only append a new header on top of the header line.


Viewing all articles
Browse latest Browse all 67469

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>