Namespace: tableSort

db.libs.tableSort

Methods

(private, static) compareDate(a, b) → {number}

Compare dates

Parameters:
Name Type Description
a external:moment
b external:moment
Source:
Returns:
Type
number

(private, static) compareNumbers(a, b) → {number}

Compare numbers

Parameters:
Name Type Description
a object
b object
Source:
Returns:
Type
number

(private, static) compareString(a, b) → {number}

Compare strings

Parameters:
Name Type Description
a object
b object
Source:
Returns:
Type
number

(private, static) getSortable(id, options) → {array}

Get the data from the column to sort

Parameters:
Name Type Description
id external:jQuery | string Selector or jQuery object for table
options object
Properties
Name Type Default Description
index number 0 Index of column to sort
type string number Type of data to sort. Accepts 'number', 'string' or 'date'
Source:
Returns:
Returns array of objects where value is the value to sort after and target is the row
Type
array

(static) sortBy(id, options) → {jQuery}

Sort table by a given column

Parameters:
Name Type Description
id external:jQuery | string Selector or jQuery object for table
options object
Properties
Name Type Default Description
index number 0 Index of column to sort
sort string desc Order of sort. Accepts 'asc' or 'desc'
type string number Type of data to sort. Accepts 'number', 'string' or 'date'
Source:
Returns:
Type
jQuery