mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-05-03 07:03:33 +02:00
Page:
3.1 Sort
Pages
1.0 Configuration
1.01 Appearance
1.02 Main features
1.03 Grid layout
1.04 Paging
1.05 Drop down filter
1.06 Checklist filter
1.07 Rows counter
1.08 Loading indicator
1.09 Submit and reset button
1.10 Status bar
1.11 Data types
1.12 Themes
1.13 Help instructions
1.14 Popup filters
1.15 No results message
1.16 Highlight keywords
1.17 State
1.18 Mark active columns
1.19 Toolbar
1.20 Single filter
2.0 TableFilter class
2.1 Public properties
2.2 Public methods
3.0 Extensions
3.1 Advanced grid
3.1 Sort
3.2 Column operations
3.3 Filters visibility
3.4 Columns visibility
4. Filter operators
Home
Obsolete
TODO
14
3.1 Sort
koalyptus edited this page 2016-10-09 14:18:12 +11:00
The sort by column feature relies on WebFX Sortable Table 1.12 by Erik Arvidsson.
To get the sort extension instance:
var sort = tf.extension('sort');where
tf
is an instance of TableFilter
.
Property | Type | Description | Remarks | Example |
---|---|---|---|---|
name | string | name of the extension, it should match the name of the directory and of the file ('sort') | var tfConfig = { extensions: [{ name: 'sort' }] }; |
|
types | array |
this array defines the data type on a column basis:
|
Note that there is a column data type resolution mechanism: if the types property is not defined the script will look for the global col_types option to resolve the column types. If there are no column types defined, the value will default to 'String'.
var tfConfig = { extensions: [{ name: 'sort', types: [ 'string', 'number', 'formatted-number', // defaults to '.' for decimal and ',' for thousands { type: 'formatted-number', decimal: ',', thousands: '.' }, 'date', { type: 'date', locale: 'fr' }, { type: 'date', locale: 'en', format: ['{dd}-{months}-{yyyy|yy}'] }, 'ipaddress' ] }] }; |
|
sort_col_at_start | array | sort a column in ascending or descending manner at start (default - null) : | format : [ column number, true|false ] where true sorts one way and false the other. eg True will sort a date column to most recent at the top. false will sort a date column to oldest at the top |
var tfConfig = { extensions: [{ name: 'sort', sort_col_at_start: [2, false] }] }; |
async_sort | boolean | enables/disables an asynchronous sorting (default - false) |
var tfConfig = { extensions: [{ name: 'sort', async_sort: true }] }; |
|
trigger_ids | array | an array defining the ids of external element triggering the sorting per column. This is useful when table headers are external to data table |
var tfConfig = { extensions: [{ name: 'sort', trigger_ids: [ 'extTh0', 'extTh1', 'extTh2', 'extTh3', 'extTh4', 'extTh5' ] }] }; |
|
on_sort_loaded | function | callback fired after sort is instantiated (default - null) | 2 parameters are sent back:
|
var tfConfig = { extensions: [{ name: 'sort', on_sort_loaded:function(o, st){ alert(st); } }] }; |
on_before_sort | function | callback fired before the column is sorted (default - null) | note 2 parameters are sent back:
|
var tfConfig = { extensions: [{ name: 'sort', on_before_sort:function(o, colIndex){ console.log('column index '+ colIndex); } }] }; |
on_after_sort | function | callback fired after the column is sorted (default - null) | note 2 parameters are sent back:
|
var tfConfig = { extensions: [{ name: 'sort', on_after_sort:function(o, colIndex){ console.log('column index '+ colIndex); } }] }; |
images_path | string | sets the images path for this extension (default - 'style/themes/') |
var tfConfig = { extensions: [{ name: 'sort', images_path: 'path/to/images/' }] }; |
|
image_blank | string | sets the default sorting icon filename (default - 'blank.png') |
var tfConfig = { extensions: [{ name: 'sort', image_blank: 'myImage.gif' }] }; |
|
custom_key | string | sets the custom sort key used to perform a custom sort (default - 'data-tf-sortKey') | This is the name of the attribute that will store the value
of the cell for sort purposes (<td data-tf-sortKey="x">value
x</td> . The sorting feature will use 'x' instead of 'value x' in this case |
var tfConfig = { extensions: [{ name: 'sort', custom_key: '_mySortKey' }] }; |
image_class_name | string | defines the css class for the sort indicator image when the column is not sorted yet (default - 'sort-arrow') | By default this is a blank image. The default sort-arrow
css class is located in the tablefilter.css stylesheet |
var tfConfig = { extensions: [{ name: 'sort', image_class_name: 'myClass' }] }; |
image_asc_class_name | string | defines the css class for the sort indicator image when the column is sorted in ascending fashion (default - 'ascending') | The default ascending css class is located in the tablefilter.css stylesheet |
var tfConfig = { extensions: [{ name: 'sort', image_asc_class_name: 'myClass' }] }; |
image_desc_class_name | string | defines the css class for the sort indicator image when the column is sorted in descending fashion (default - 'descending') |
The default descending css class is located in the tablefilter.css stylesheet |
var tfConfig = { extensions: [{ name: 'sort', image_desc_class_name: 'myClass' }] }; |
msg_sort | string | text displayed when a table column is sorted (default - 'Sorting data...') | var tfConfig = { msg_sort: 'Sorting...' } |