1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-06-01 05:23:02 +02:00

Started adapterSortabletable doco

This commit is contained in:
Max Guglielmi 2016-09-05 23:05:20 +10:00
parent 2bed4c656a
commit a0019df507

View file

@ -6,25 +6,61 @@ import {formatDate} from '../../date';
import {removeNbFormat} from '../../helpers'; import {removeNbFormat} from '../../helpers';
import {NONE, CELL_TAG, HEADER_TAG} from '../../const'; import {NONE, CELL_TAG, HEADER_TAG} from '../../const';
/**
* SortableTable Adapter module
*/
export default class AdapterSortableTable extends Feature { export default class AdapterSortableTable extends Feature {
/** /**
* SortableTable Adapter module * Creates an instance of AdapterSortableTable
* @param {Object} tf TableFilter instance * @param {TableFilter} tf TableFilter instance
* @param {Object} opts Configuration object
*/ */
constructor(tf, opts) { constructor(tf, opts) {
super(tf, opts.name); super(tf, opts.name);
/**
* Module name
* @type {String}
*/
this.name = opts.name; this.name = opts.name;
/**
* Module description
* @type {String}
*/
this.desc = opts.description || 'Sortable table'; this.desc = opts.description || 'Sortable table';
//indicates if table previously sorted /**
* Indicate whether table previously sorted
* @type {Boolean}
* @private
*/
this.sorted = false; this.sorted = false;
/**
* List of sort type per column basis
* @type {Array}
*/
this.sortTypes = isArray(opts.types) ? opts.types : []; this.sortTypes = isArray(opts.types) ? opts.types : [];
/**
* Column to be sorted at initialization
* @type {Array}
*/
this.sortColAtStart = isArray(opts.sort_col_at_start) ? this.sortColAtStart = isArray(opts.sort_col_at_start) ?
opts.sort_col_at_start : null; opts.sort_col_at_start : null;
/**
* Enable asynchronous sort, if triggers are external
* @type {Boolean}
*/
this.asyncSort = Boolean(opts.async_sort); this.asyncSort = Boolean(opts.async_sort);
/**
* List of of element IDs triggering sort on a per column basis
* @type {Array}
*/
this.triggerIds = isArray(opts.trigger_ids) ? opts.trigger_ids : []; this.triggerIds = isArray(opts.trigger_ids) ? opts.trigger_ids : [];
// edit .sort-arrow.descending / .sort-arrow.ascending in // edit .sort-arrow.descending / .sort-arrow.ascending in