Download
Demo
- Overview
- Documents
User Rating: 5/5 ( 1 votes)
Your Rating:
TinySort is a small and simple jQuery plugin that will sort any nodetype by it's text- or attribute value, or by that of one of it's children.
Source: tinysort.sjeiti.com
1. INCLUDE JS FILES
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.js"></script> <script>window.jQuery||document.write("<script src='libs/jquery-2.0.3.js'>\x3C/script>")</script> <script src="src/jquery.tinysort.js"></script>
2. HTML
<ul id="xdflt" class="xmpl"> <li>gimoira</li> <li>audlaupoak</li> <li>exysvoed</li> <li>nopoefdei</li> <li>iugtoigyj</li> <li>lodboala</li> </ul>
3. JAVASCRIPT
$(document).ready(function(){ $('ul#xdflt>li').tsort(); });
4. OPTIONS
property | type | description | possible values | default | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
order | String | the order of the sorting method |
|
"asc" | ||||||||
attr | String | order by attribute value (ie title, href, class) | anything | "" | ||||||||
useVal | Boolean | use element value instead of text |
|
false | ||||||||
data | String | use the data attribute for sorting |
|
null | ||||||||
charOrder | String | use the data attribute for sorting |
|
null | ||||||||
place | String | determines the placement of the ordered elements in respect to the unordered elements filtered out by using the 'attr' setting or the first parsed 'find' string |
|
"start" | ||||||||
returns | Boolean | affects the returned jquery array |
|
false | ||||||||
cases | Boolean | a case sensitive sort (orders [aB,aa,ab,bb]) |
|
false | ||||||||
ignoreDashes | Boolean | ignore dashes when matching numerals to prevent negative numbers |
|
false | ||||||||
forceStrings | Boolean | use string value for numerals |
|
false | ||||||||
sortFunction | function | override the default sort function |
any sort function like function(a,b){return -1,0,1;} where the two parameters are objects with the following properties:
|
. |