1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-05-05 08:03:17 +02:00

Initial commit

This commit is contained in:
Max Guglielmi 2016-04-12 09:49:54 +02:00
parent 87d63f04ae
commit 974c9c95e9
4 changed files with 18 additions and 5 deletions

View file

@ -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)
* 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)
* And even more behaviors...
* And even more features...
* Attach to an existing HTML table
* Integration with any server-side technology as this is a pure client-side
solution
* Callbacks for all events, and delegates for most actions
* Exhaustive documentation and API
* Exhaustive documentation and poweful API
## Getting started
* Clone the repo using Git:

View file

@ -1,6 +1,6 @@
{
"name": "tablefilter",
"version": "0.2.10",
"version": "0.2.11",
"description": "A Javascript library making HTML tables filterable and a bit more",
"license": "MIT",
"author": {

View file

@ -1,4 +1,3 @@
// import 'script!sortabletable';
import AdapterSortableTable from './adapterSortabletable';
if(!window.SortableTable){

View file

@ -33,12 +33,14 @@ export class State extends Feature {
this.persistFilters = cfg.filters === false ? false : true;
this.persistPageNumber = Boolean(cfg.page_number);
this.persistPageLength = Boolean(cfg.page_length);
this.persistSort = Boolean(cfg.sort);
this.cookieDuration = !isNaN(cfg.cookie_duration) ?
parseInt(cfg.cookie_duration, 10) : 87600;
this.hash = null;
this.pageNb = null;
this.pageLength = null;
this.sortIndex = null;
this.state = {};
this.prfxCol = 'col_';
@ -59,6 +61,8 @@ export class State extends Feature {
(tf, pageNb) => this.updatePage(pageNb));
this.emitter.on(['after-page-length-change'],
(tf, index) => this.updatePageLength(index));
this.emitter.on(['column-sorted'],
(tf, index) => this.updateSort(index));
if (this.enableHash) {
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);
}
@ -138,6 +146,11 @@ export class State extends Feature {
this.update();
}
updateSort(index){
this.sortIndex = index;
this.update();
}
/**
* Override state field
*
@ -209,6 +222,8 @@ export class State extends Feature {
(tf, pageNb) => this.updatePage(pageNb));
this.emitter.off(['after-page-length-change'],
(tf, index) => this.updatePageLength(index));
this.emitter.off(['column-sorted'],
(tf, index) => this.updateSort(index));
if (this.enableHash) {
this.hash.destroy();