Sort by column keys for complex headers
mainIn tables with complex header structures (like colspan), you can explicitly link a header to specific data cells using the data-sort-column-key attribute. Apply this attribute to both the <th> and the corresponding <td> elements to ensure the correct data is used for sorting.
<table class='sort'>
<thead>
<tr>
<th>Product</th>
<th colspan="2" data-sort-column-key="price">Price</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apples</td>
<td data-sort-column-key="price">20</td>
</tr>
</tbody>
</table>