How to sort a tree table by rows (header on the left) with no <thead>


I want to sort a tree table not by columns but rows, its header is on the left in the tree part.
My tree table looks like this
the tree table plugin I used:https://www.jqueryscript.net/demo/simple-tree-table/

And the code is something like this

  <table>
      <tr data-node-id="index">
        <th>Index</th>
        <td>...</td>
        <td>...</td>
      </tr>
      <tr data-node-id="patient">
        <th>Patient Characteristics</th>
      </tr>
      <tr data-node-id="name" data-node-pid="patient">
        <th>Name</th>
        <td>...</td>
        <td>...</td>
      </tr> 
      <tr data-node-id="DOB" data-node-pid="patient">
        <th>DOB</th>
        <td>...</td>
        <td>...</td>
      </tr> 
      <tr data-node-id="age" data-node-pid="patient">
      ...

There is no <thead> part, so many sorting methods not work well on this table. I’m new to javascript sort of things, and have no idea if this is easy to do. But I did not find methods for this situation online, so I try to ask for help.

Source: CSS – Stack Overflow

October 24, 2021
Category : News
Tags: css | html | javascript | treetable

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.