File: SortableTable.docs.js

Recommend this page to a friend!
  Classes of Jackson Knowlton   JS Sortable Table   SortableTable.docs.js   Download  
File: SortableTable.docs.js
Role: Documentation
Content type: text/plain
Description: Documentation for SortableTable class
Class: JS Sortable Table
Make HTML tables sortable with clickable headers
Author: By
Last change: edited
Date: 8 years ago
Size: 1,665 bytes
 

Contents

Class file image Download
/* JS SortableTable Object Version 2.1 source : /SortableTable.object.js dependencies: /SortableTable.styles.css - and - jQuery This JavaScript Object is useful for tables with a lot of data. It takes a normal html table and makes it sortable by the user. Also built in is the ability to sort any column, at any time, by calling one of the functions. (See: Sorting Using The Built-In Function) Initiating Object Initializing puts the sorting arrows and click listeners on the table header. - Calling initialization function: - Parameter: {pointer} | this can be either a string, (ex: '.sortableTables'), or a jquery object (ex: $('#dataTbls').find('table') ...) - Note: Initializing code MUST be in document.ready function or at the end of the page. - Example of initializing code: sortable_table = new SortableTable(); sortable_table.init('table'); //Makes all html tables on the page be sortable. Sorting Using The Built-In Function - Parameters: {table} | This specifies the table to be sorted. MUST BE A JQUERY OBJECT! {columnNum} | Specifies what column to sort. (ie. 1, 3...) {sortDirection} | Specifies what direction to sort. (up or down) - Notes: The only required parameter is the table. By default, it sorts the first column in descending order. Also, the table does NOT have to be initialized for the sort function to work. - Example of code: sortable_table = new SortableTable(); sortable_table.sort($('#table1'), 2, down); //Sorts the second column in the table #table1 in descending order