CUTCODEDOWN
Minimalist Semantic Markup

Welcome Guest
Please Login or Register

If you have registered but not recieved your activation e-mail in a reasonable amount of time, or have issues with using the registration form, please use our Contact Form for assistance. Include both your username and the e-mail you tried to register with.

Author Topic: JavaScript: Easy Table Sorting  (Read 113 times)

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 650
  • Karma: +116/-1
    • CutCodeDown -- Minimalist Semantic Markup
JavaScript: Easy Table Sorting
« on: 10 Dec 2020, 08:03:53 am »
Wrote a medium article on the topic refining someone else's example in preparation for expanding it further:
https://deathshadow.medium.com/javascript-table-sorting-part-1-of-2-start-out-simple-1df3e0be8d4e

As always, example directory for those of you who hit up against the read limit:
https://cutcodedown.com/for_others/medium_articles/tableSort/simple/

With a .rar of the whole deal in there.

The script itself isn't too complex, at 1.83k it basically is a snippet.

The whole intent being that if you have a well-formed semantic table with TH, THEAD, TBODY, and so forth, a few simple data- attributes is all we need as hooks for JS to perform our sorts, and a bit of CSS to add the visual sort state. About as "plug and play" as you can get with vanilla scripting.

Which is what I liked about the original guy's article here:
https://medium.com/javascript-in-plain-english/easy-table-sorting-with-javascript-370d8d97cad8
« Last Edit: 10 Dec 2020, 08:06:34 am by Jason Knight »
Sorrow hides well in your shell. A fellow man with hurt to spare.
Dear one, here I am to share the fear. An act of kindness, without an amen.
Come in, the fire's warm. Burn the rope and dance some more.

Jason Knight

  • Administrator
  • Hero Member
  • *****
  • Posts: 650
  • Karma: +116/-1
    • CutCodeDown -- Minimalist Semantic Markup
Sorrow hides well in your shell. A fellow man with hurt to spare.
Dear one, here I am to share the fear. An act of kindness, without an amen.
Come in, the fire's warm. Burn the rope and dance some more.

 

SMF spam blocked by CleanTalk

Advertisement