Skip to content

Latest commit

 

History

10 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Dentropize

Javascript function to sort tables

Demo

GitHub Pages

Install

  • Copy in the dentropize.js to your project or use jsDelivr.
    • vendor/javascript/dentropize.js for Rails.
  • Import the function
  • Add to the appropriate event for your framework.
  • Example below is a Rails 7 app using Importmaps and Turbo
// app/javascript/application.js

import dentropize from "dentropize"
document.addEventListener('turbo:load', dentropize);
# config/importmap.rb

pin "dentropize", to: "dentropize.js"

Usage

  • Add the CSS class "sortable" to your table.
  • To sort by a hidden value use "data-sort"
    • <td data-sort="5">five</td>

Notes

  • This code is essentially a heavily modified sortable made to work like jquery tablesorter but only the parts you really REALLY need.
  • There is no requirement for a <tbody> instead any rows NOT in a <thead> or <tfoot> are sorted.

About

Javascript function to sort tables

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages