This is my first time using list.js and for some reason it is not working.
Here is a live example. http://hartslogmuseum.com/bookhjr10/test.php here is what its supp
You probably forgot one of the minimal requirements.
These seem the minimal requirements:
list.jstbody must have the class listtd, not on the th - although you can also add it to the th).sortdata-sort with a value matching the name of the column's class name to be sortedHere are a couple of list.js codepen examples using tables (this is from http://listjs.com/examples/add-get-remove):
Minimal code example:
see also on http://jsfiddle.net/d7fJs/
Gender
Age
City
male
18
Berlin
female
46
Reykjavik
female
20
Lisboa
Note: if the sorting behaves strangely - ie. the sorting is incorrect - it might be because you are missing one of the basic requirements. If you struggle, do a jsfiddle & ask your question on stackoverflow with a link to it.
If you want to avoid using this ID in the wrapping element, and use a custom selector instead, you can replace:
var contactList = new List('my-cool-sortable-table-wrapper', options);
By this:
var wrapperElement = $('.my .custom .selector');
var contactList = new List(wrapperElement[0], options);
see:
If you want to detect change events triggered by List.js & act accordingly (here we update row class names accordingly)
contactList.on("updated", function(){
$('#my-cool-sortable-table-wrapper tr').removeClass('odd').filter(':visible:odd').addClass("odd");
})
List.js handles different event types. See full list at the bottom of this page http://listjs.com/docs/list-api
Official documentation http://listjs.com/docs/options