mirror of
https://github.com/koalyptus/TableFilter.git
synced 2026-03-18 08:29:50 +01:00
Removed Cookie dependency in TableFilter class
This commit is contained in:
parent
885b957d31
commit
e5a67eeee9
12 changed files with 9905 additions and 41 deletions
|
|
@ -21,6 +21,7 @@ export class Store{
|
|||
init(){
|
||||
this.emitter.on(['after-filtering'],
|
||||
()=> this.saveFilterValues(this.tf.fltsValuesCookie));
|
||||
this.emitter.on(['after-clearing-filters'], ()=> this.clearCookies());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -43,8 +44,6 @@ export class Store{
|
|||
}
|
||||
fltValues.push(value);
|
||||
}
|
||||
//adds array size
|
||||
//fltValues.push(tf.fltIds.length);
|
||||
|
||||
//writes cookie
|
||||
Cookie.write(
|
||||
|
|
@ -114,8 +113,18 @@ export class Store{
|
|||
return Cookie.read(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all cookies
|
||||
*/
|
||||
clearCookies(){
|
||||
Cookie.remove(this.tf.fltsValuesCookie);
|
||||
Cookie.remove(this.tf.pgLenCookie);
|
||||
Cookie.remove(this.tf.pgNbCookie);
|
||||
}
|
||||
|
||||
destroy(){
|
||||
this.emitter.off(['after-filtering'],
|
||||
()=> this.saveFilterValues(this.tf.fltsValuesCookie));
|
||||
this.emitter.off(['after-clearing-filters'], ()=> this.clearCookies());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import Event from './event';
|
||||
import Dom from './dom';
|
||||
import Str from './string';
|
||||
import Cookie from './cookie';
|
||||
// import Cookie from './cookie';
|
||||
import Types from './types';
|
||||
import Arr from './array';
|
||||
import DateHelper from './date';
|
||||
|
|
@ -380,7 +380,7 @@ export class TableFilter {
|
|||
this.prfxCookiePageLen = 'tf_pglen_';
|
||||
|
||||
/*** cookies ***/
|
||||
this.hasStoredValues = false;
|
||||
// this.hasStoredValues = false;
|
||||
//remembers filters values on page load
|
||||
this.rememberGridValues = Boolean(f.remember_grid_values);
|
||||
//cookie storing filter values
|
||||
|
|
@ -1500,7 +1500,7 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the data of a specified colum
|
||||
* Return the data of a specified column
|
||||
* @param {Number} colIndex Column index
|
||||
* @param {Boolean} includeHeaders Optional: include headers row
|
||||
* @param {Boolean} num Optional: return unformatted number
|
||||
|
|
@ -2021,12 +2021,12 @@ export class TableFilter {
|
|||
// if(this.linkedFilters){
|
||||
// this.linkFilters();
|
||||
// }
|
||||
if(this.rememberPageLen){ Cookie.remove(this.pgLenCookie); }
|
||||
if(this.rememberPageNb){ Cookie.remove(this.pgNbCookie); }
|
||||
if(this.onAfterReset){ this.onAfterReset.call(null, this); }
|
||||
// if(this.rememberPageLen){ Cookie.remove(this.pgLenCookie); }
|
||||
// if(this.rememberPageNb){ Cookie.remove(this.pgNbCookie); }
|
||||
|
||||
this.filter();
|
||||
|
||||
if(this.onAfterReset){ this.onAfterReset.call(null, this); }
|
||||
this.emitter.emit('after-clearing-filters', this);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue