mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-06-16 20:55:17 +02:00
Initial commit
This commit is contained in:
parent
87d63f04ae
commit
974c9c95e9
|
@ -15,12 +15,11 @@ users to filter and limit the data displayed within a long table. By default, th
|
||||||
* Extended keyboard navigation ([ezEditTable](http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus) extension)
|
* Extended keyboard navigation ([ezEditTable](http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus) extension)
|
||||||
* Inline cell or row editing ([ezEditTable](http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus) extension)
|
* Inline cell or row editing ([ezEditTable](http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus) extension)
|
||||||
* Row insertion or deleting ([ezEditTable](http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus) extension)
|
* Row insertion or deleting ([ezEditTable](http://codecanyon.net/item/ezedittable-enhance-html-tables/2425123?ref=koalyptus) extension)
|
||||||
* And even more behaviors...
|
* And even more features...
|
||||||
* Attach to an existing HTML table
|
* Attach to an existing HTML table
|
||||||
* Integration with any server-side technology as this is a pure client-side
|
* Integration with any server-side technology as this is a pure client-side
|
||||||
solution
|
solution
|
||||||
* Callbacks for all events, and delegates for most actions
|
* Exhaustive documentation and poweful API
|
||||||
* Exhaustive documentation and API
|
|
||||||
|
|
||||||
## Getting started
|
## Getting started
|
||||||
* Clone the repo using Git:
|
* Clone the repo using Git:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "tablefilter",
|
"name": "tablefilter",
|
||||||
"version": "0.2.10",
|
"version": "0.2.11",
|
||||||
"description": "A Javascript library making HTML tables filterable and a bit more",
|
"description": "A Javascript library making HTML tables filterable and a bit more",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"author": {
|
"author": {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
// import 'script!sortabletable';
|
|
||||||
import AdapterSortableTable from './adapterSortabletable';
|
import AdapterSortableTable from './adapterSortabletable';
|
||||||
|
|
||||||
if(!window.SortableTable){
|
if(!window.SortableTable){
|
||||||
|
|
|
@ -33,12 +33,14 @@ export class State extends Feature {
|
||||||
this.persistFilters = cfg.filters === false ? false : true;
|
this.persistFilters = cfg.filters === false ? false : true;
|
||||||
this.persistPageNumber = Boolean(cfg.page_number);
|
this.persistPageNumber = Boolean(cfg.page_number);
|
||||||
this.persistPageLength = Boolean(cfg.page_length);
|
this.persistPageLength = Boolean(cfg.page_length);
|
||||||
|
this.persistSort = Boolean(cfg.sort);
|
||||||
this.cookieDuration = !isNaN(cfg.cookie_duration) ?
|
this.cookieDuration = !isNaN(cfg.cookie_duration) ?
|
||||||
parseInt(cfg.cookie_duration, 10) : 87600;
|
parseInt(cfg.cookie_duration, 10) : 87600;
|
||||||
|
|
||||||
this.hash = null;
|
this.hash = null;
|
||||||
this.pageNb = null;
|
this.pageNb = null;
|
||||||
this.pageLength = null;
|
this.pageLength = null;
|
||||||
|
this.sortIndex = null;
|
||||||
|
|
||||||
this.state = {};
|
this.state = {};
|
||||||
this.prfxCol = 'col_';
|
this.prfxCol = 'col_';
|
||||||
|
@ -59,6 +61,8 @@ export class State extends Feature {
|
||||||
(tf, pageNb) => this.updatePage(pageNb));
|
(tf, pageNb) => this.updatePage(pageNb));
|
||||||
this.emitter.on(['after-page-length-change'],
|
this.emitter.on(['after-page-length-change'],
|
||||||
(tf, index) => this.updatePageLength(index));
|
(tf, index) => this.updatePageLength(index));
|
||||||
|
this.emitter.on(['column-sorted'],
|
||||||
|
(tf, index) => this.updateSort(index));
|
||||||
|
|
||||||
if (this.enableHash) {
|
if (this.enableHash) {
|
||||||
this.hash = new Hash(this);
|
this.hash = new Hash(this);
|
||||||
|
@ -115,6 +119,10 @@ export class State extends Feature {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this.persistSort){
|
||||||
|
let key = `${this.prfxCol}${this.sortIndex}`;
|
||||||
|
}
|
||||||
|
|
||||||
this.emitter.emit('state-changed', tf, this.state);
|
this.emitter.emit('state-changed', tf, this.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +146,11 @@ export class State extends Feature {
|
||||||
this.update();
|
this.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateSort(index){
|
||||||
|
this.sortIndex = index;
|
||||||
|
this.update();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override state field
|
* Override state field
|
||||||
*
|
*
|
||||||
|
@ -209,6 +222,8 @@ export class State extends Feature {
|
||||||
(tf, pageNb) => this.updatePage(pageNb));
|
(tf, pageNb) => this.updatePage(pageNb));
|
||||||
this.emitter.off(['after-page-length-change'],
|
this.emitter.off(['after-page-length-change'],
|
||||||
(tf, index) => this.updatePageLength(index));
|
(tf, index) => this.updatePageLength(index));
|
||||||
|
this.emitter.off(['column-sorted'],
|
||||||
|
(tf, index) => this.updateSort(index));
|
||||||
|
|
||||||
if (this.enableHash) {
|
if (this.enableHash) {
|
||||||
this.hash.destroy();
|
this.hash.destroy();
|
||||||
|
|
Loading…
Reference in a new issue