4

I have a table that looks a little like this:

    ID    Paragraph  Title
    1     §1-1       This is the first
    2     §2-1       This is the second
...
    12    §10-1      This is the twelfth

The 'ID' column is hidden, the other two are visible. I've managed to get JQuery Tablesorter to work on sorting Paragraph and Title columns, however I would like to use the ID values when sorting the Paragraph column. Simply because the sorting is incorrect when using the Paragraph column as one can easily see.

Is it possible to somehow make tablesorter use the ID column/values when sorting the Paragraph column?

1 Answer 1

3

I think the easiest solution would be to just add a hidden span in the paragraph column with the ID inside and a space after to separate it from the text (<span class="hidden"># </span>) (demo)

<tr>
  <td>1</td>
  <td><span class="hidden">1 </span>Paragraph of text</td>
</tr>
Sign up to request clarification or add additional context in comments.

1 Comment

This along with the JQuery Metadata plugin and a bit of magic on the table header made it all work. The magic bit is: <th class="{sorter: 'digit'}">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.