html - Sort table with unknown number of headers using jQuery Table Sort, then only sort on 2 headers -
the scenario i have table on web page dynamically generated using jsp. number of columns/headers variable (could 6 or 40+). i'm using jquery tablesorter sort table. table should sort on header elements 5 , 6 moment. the question using tablesorter allows set header elements false , disabling them sort options. since number of headers variable need way of inverting options can set sorter option true , rest disabled default. either that, or need way total number of header elements , run through loop set them false. the syntax little tricky me i'm not sure how loop through following: $(document).ready(function() { $("table").tablesorter({ headers: { 0: { sorter: false }, 1: { sorter: false } . . . } }); }); so 2 want sort on in example "primary di