How do I implement numeric table sorting? #8151
Replies: 1 comment
-
I've realised I made a very simple error - I adapted tablesort's demo code using local JS, to using So my ..
extra_javascript:
- https://unpkg.com/[email protected]/dist/tablesort.min.js
- https://unpkg.com/[email protected]/dist/sorts/tablesort.number.min.js
- javascripts/tablesort.js |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I got string sorting working fine by following the docs, but I can't work out how to get numeric sort working.
I've added the extra
tablesort
component tomkdocs.yml
:And I have a very simple table:
My understanding is that this should be sufficient to enable numeric sorting on Column 1, but it uses string sorting 1,10,2 / 2,10,1.
I then read How to specify the sort method for a column in a sortable table, took the suggestion to use HTML instead of Markdown in order to add the custom attribute, copied the generated HTML and added an explicit sort method on Column 1:
But this behaves the same way. I can see
tablesort.number.js
is linked in the generated HTML, but I don't know Javascript, so am unsure how to troubleshoot further.Beta Was this translation helpful? Give feedback.
All reactions