# tablesorter **Repository Path**: milometer/tablesorter ## Basic Information - **Project Name**: tablesorter - **Description**: Flexible client-side table sorting - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-10-21 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README tablesorter =========== ###Flexible client-side table sorting ####Getting started To use the tablesorter plugin, include the jQuery library and the tablesorter plugin inside the head-tag of your HTML document: ```html ``` Tablesorter works on all standard HTML tables. You must include THEAD and TBODY tags: ```html
Last Name First Name Email Due Web Site
Smith John jsmith@gmail.com $50.00 http://www.jsmith.com
Bach Frank fbach@yahoo.com $50.00 http://www.frank.com
Doe Jason jdoe@hotmail.com $100.00 http://www.jdoe.com
Conway Tim tconway@earthlink.net $50.00 http://www.timconway.com
``` Start by telling tablesorter to sort your table when the document is loaded: ```javascript $(document).ready(function() { $("#myTable").tablesorter(); } ); ``` Click on the headers and you'll see that your table is now sortable! You can also pass in configuration options when you initialize the table. This tells tablesorter to sort on the first and second column in ascending order. ```javascript $(document).ready(function() { $("#myTable").tablesorter( {sortList: [[0,0], [1,0]]} ); } ); ``` For DateTime columns you can specify your format, like this: ```javascript $(document).ready(function() { $("#myTable").tablesorter( {dateFormat: 'pt'} ); } ); ``` The available ones (currently) are: us, pt and uk. (for pt you can use 'dd/MM/yyyy hh:mm:ss')