# tablesorter

## File Type Parser

### Flexible client-side table sorting

Back to documentation

- If this parser finds the file type extension within the equivalents list, it will add the equivalents group name to the beginning of the file so that during sorting, those file names will sort by the group they are in.
- Please look in the javascript code section below for a full list of default equivalents. This list is by no means extensive, but it can be easily modified or extended as needed.
- To add a new group to the equivalents list, just define a new group, before initializing tablesorter, as follows:

      $.tablesorter.fileTypes.equivalents['xx'] = "A|B|C"

- But lets say your table is primarily being used to sort font file names, but you notice "svg" is listed under "vectors" (graphics) so you want to modify the equivalents list. Do it as follows:

      $.tablesorter.fileTypes.equivalents["Vectors"] = "awg|ai|eps|cdr"; // redefine vectors without "svg"
      $.tablesorter.fileTypes.equivalents["Fonts"] += '|svg'; // just add it to the end (but first include the vertical bar = shift+\; above the enter key)!

- This parser only looks to see if an extension exists within the equivalents list, so any separator can be used (spaces, commas or vertical bars).

# Demo

(swap media column between "group-separator-1" & "group-separator-2")

Desktop Files | Tablesorter Files | Media | Media Files
--- | --- | --- | ---
github.url | package.json | Music Disc #1 - Green Day - Boulevard of Broken Dreams | Muse - Supermassive Black Hole.mp3
tablesorter.zip | readme.md | Music Disc #1 - Green Day - Holiday | Gorillaz - Feel Good Inc.mp3
learn-git.pdf | index.html | Music Disc #1 - M83 - Midnight City | M83 - Midnight City.mp4
pancake-cat.jpg | jquery.tablesorter.js | Music Disc #1 - Bob Marley - Everything is Gonna Be Alright | Radiohead - Creep.ogg
to-do-list.txt | theme.blue.css | Music Disc #1 - Bob Marley - Jamming | Ellie Goulding - Lights.flv
css-tips.docx | theme.less | Music Disc #1 - Bob Marley - Oh, Baby I Love Your Way | Imagine Dragons - Radioactive.avi
frisbee-cat.png | black-asc.gif | Music Disc #1 - Bob Marley - Red Red Wine | Muse - Supermassive Black Hole.avi
Diablo.lnk | green-unsorted.psd | Music Disc #1 - Bob Marley - No Woman No Cry | Alex Clare - Too Close.wma
Warcraft.lnk | jquery.tablesorter.widgets.js | Music Disc #2 - Sublime - Santeria | The XX - Intro.mp3
google.url | glyphicons-halflings.png | Music Disc #2 - Sublime - What I Got | AWOLNATION - Sail.wmv
swimming-cat.gif | component.json | Music Disc #2 - Massive Attack - Teardrop | Of Monsters and Men - Little Talks.m4a
photo-album.zip | themes.html | Music Disc #2 - Massive Attack - Dissolved Girl | Nina Simone - Feeling Good.flac

# Javascript

# HTML

Next up: Force a default sorting order ››