Continued refactoring EvtManager
This commit is contained in:
parent
b3e236e111
commit
ea478ec500
|
@ -1,10 +1,10 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>tablefilter v0.1.3 - Starter</title>
|
||||
<title>tablefilter v0.1.4 - Starter</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>tablefilter v0.1.3</h1>
|
||||
<h1>tablefilter v0.1.4</h1>
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.1.3 by Max Guglielmi
|
||||
* build date: 2016-01-02T03:37:45.442Z
|
||||
* tablefilter v0.1.4 by Max Guglielmi
|
||||
* build date: 2016-01-02T14:26:21.155Z
|
||||
* MIT License
|
||||
*/
|
||||
span.colVisSpan{text-align:left;}span.colVisSpan a.colVis{display:inline-block;padding:7px 5px 0;font-size:inherit;font-weight:inherit;vertical-align:top}div.colVisCont{position:relative;background:#fff;-webkit-box-shadow:3px 3px 2px #888;-moz-box-shadow:3px 3px 2px #888;box-shadow:3px 3px 2px #888;position:absolute;display:none;border:1px solid #ccc;height:auto;width:250px;background-color:#fff;margin:35px 0 0 -100px;z-index:10000;padding:10px 10px 10px 10px;text-align:left;font-size:12px;}div.colVisCont:after,div.colVisCont:before{bottom:100%;left:50%;border:solid transparent;content:" ";height:0;width:0;position:absolute;pointer-events:none}div.colVisCont:after{border-color:rgba(255,255,255,0);border-bottom-color:#fff;border-width:10px;margin-left:-10px}div.colVisCont:before{border-color:rgba(255,255,255,0);border-bottom-color:#ccc;border-width:12px;margin-left:-12px}div.colVisCont p{margin:6px auto 6px auto}div.colVisCont a.colVis{display:initial;font-weight:inherit}ul.cols_checklist{padding:0;margin:0;list-style:none;}ul.cols_checklist label{display:block}ul.cols_checklist input{vertical-align:middle;margin:2px 5px 2px 1px}li.cols_checklist_item{padding:4px;margin:0;}li.cols_checklist_item:hover{background-color:#335ea8;color:#fff}.cols_checklist_slc_item{background-color:#335ea8;color:#fff}
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.1.3 by Max Guglielmi
|
||||
* build date: 2016-01-02T03:37:45.442Z
|
||||
* tablefilter v0.1.4 by Max Guglielmi
|
||||
* build date: 2016-01-02T14:26:21.155Z
|
||||
* MIT License
|
||||
*/
|
||||
span.expClpFlt a.btnExpClpFlt{width:35px;height:35px;display:inline-block;}span.expClpFlt a.btnExpClpFlt:hover{background-color:#f4f4f4}span.expClpFlt img{padding:8px 11px 11px 11px}
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.1.3 by Max Guglielmi
|
||||
* build date: 2016-01-02T03:37:45.442Z
|
||||
* tablefilter v0.1.4 by Max Guglielmi
|
||||
* build date: 2016-01-02T14:26:21.155Z
|
||||
* MIT License
|
||||
*/
|
||||
.activeHeader{background-color:#66afe9 !important;color:#fff !important}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.1.3 by Max Guglielmi
|
||||
* build date: 2016-01-02T03:37:45.442Z
|
||||
* tablefilter v0.1.4 by Max Guglielmi
|
||||
* build date: 2016-01-02T14:26:21.155Z
|
||||
* MIT License
|
||||
*/
|
||||
table.TF{border-left:1px solid #ccc !important;border-top:none !important;border-right:none !important;border-bottom:none !important;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important;color:#333 !important}table.TF td{border-bottom:1px dotted #999 !important;padding:5px !important}.fltrow{background-color:#ebecee !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #666 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #999 !important}input.flt{width:99% !important}.inf{height:$min-height;background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important}input.reset{background:transparent url("images/btn_eraser.gif") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;}.nextPage:hover{background:transparent url("images/btn_over_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important;}.previousPage:hover{background:transparent url("images/btn_over_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;}.firstPage:hover{background:transparent url("images/btn_over_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;}.lastPage:hover{background:transparent url("images/btn_over_last_page.gif") center center no-repeat !important}div.grd_Cont{background-color:#ebecee !important;border:1px solid #ccc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#d5d5d5}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important;}div.grd_headTblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#ebecee url("images/bg_th.jpg") left top repeat-x !important;border-bottom:1px solid #d0d0d0 !important;border-right:1px solid #d0d0d0 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #999 !important}.grd_inf{background:#d7d7d7 url("images/bg_infDiv.jpg") 0 0 repeat-x !important;border-top:1px solid #d0d0d0 !important}.loader{border:1px solid #999}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#fff}.odd{background-color:#d5d5d5}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.1.3 by Max Guglielmi
|
||||
* build date: 2016-01-02T03:37:45.442Z
|
||||
* tablefilter v0.1.4 by Max Guglielmi
|
||||
* build date: 2016-01-02T14:26:21.155Z
|
||||
* MIT License
|
||||
*/
|
||||
table.TF{border-left:1px dotted #81963b !important;border-top:none !important;border-right:0 !important;border-bottom:none !important;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;color:#fff !important}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px !important}.fltrow{background-color:#81963b !important;}.fltrow th,.fltrow td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #687830 !important}input.flt{width:99% !important}.inf{background:#d8d8d8;height:$min-height}input.reset{width:53px;background:transparent url("images/btn_filter.png") center center no-repeat !important}.helpBtn:hover{background-color:transparent}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important}.previousPage{background:transparent url("images/btn_previous_page.gif") center center no-repeat !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important}div.grd_Cont{background:#81963b url("images/bg_headers.jpg") left top repeat-x !important;border:1px solid #ccc !important;padding:0 1px 1px 1px !important;}div.grd_Cont .even{background-color:#bccd83}div.grd_Cont .odd{background-color:#fff}div.grd_headTblCont{background-color:#ebecee !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important;}div.grd_tblCont table td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b}div.grd_tblCont table th,div.grd_headTblCont table th{background:transparent url("images/bg_headers.jpg") 0 0 repeat-x !important;border-bottom:0 !important;border-right:1px dotted #d0d0d0 !important;border-left:0 !important;border-top:0 !important;padding:0 4px 0 4px !important;color:#fff !important;height:35px !important}div.grd_headTblCont table td{border-bottom:1px dotted #39424b !important;border-right:1px dotted #fff !important;border-left:0 !important;border-top:0 !important;background-color:#81963b !important;padding:1px 3px 1px 3px !important}.grd_inf{background-color:#d8d8d8;border-top:1px solid #d0d0d0 !important}.loader{border:0 !important;background:#81963b !important}.defaultLoader{width:32px;height:32px;background:transparent url("images/img_loading.gif") 0 0 no-repeat !important}.even{background-color:#bccd83}.odd{background-color:#fff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}
|
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.1.3 by Max Guglielmi
|
||||
* build date: 2016-01-02T03:37:45.442Z
|
||||
* tablefilter v0.1.4 by Max Guglielmi
|
||||
* build date: 2016-01-02T14:26:21.155Z
|
||||
* MIT License
|
||||
*/
|
||||
table.TF{padding:0;color:#000;border-right:1px solid #a4bed4;border-top:1px solid #a4bed4;border-left:1px solid #a4bed4;border-bottom:0;}table.TF th{margin:0;color:inherit;background:#d1e5fe url("images/bg_skyblue.gif") 0 0 repeat-x;border-color:#fdfdfd #a4bed4 #a4bed4 #fdfdfd;border-width:1px;border-style:solid}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid #a4bed4;border-left:0;border-top:0;border-right:0}.fltrow{background-color:#d1e5fe !important;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px !important}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4 !important}input.flt{width:99% !important}.inf{background-color:#e3efff !important;border:1px solid #a4bed4;height:$min-height;color:#004a6f}div.tot,div.status{border-right:0 !important}.helpBtn:hover{background-color:transparent}input.reset{background:transparent url("images/icn_clear_filters.png") center center no-repeat !important}.nextPage{background:transparent url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.nextPage:hover{background:#ffe4ab url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#ffe4ab url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#ffe4ab url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#ffe4ab url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #ffb552 !important}.activeHeader{background:#ffe4ab !important;border:1px solid #ffb552 !important;color:inherit !important}div.grd_Cont{background-color:#d9eaed !important;border:1px solid #9cc !important;padding:0 !important;}div.grd_Cont .even{background-color:#fff}div.grd_Cont .odd{background-color:#e3efff}div.grd_headTblCont{background-color:#d9eaed !important;border-bottom:none !important}div.grd_tblCont table{border-right:none !important}div.grd_tblCont table th,div.grd_headTblCont table th,div.grd_headTblCont table td{background:#d9eaed url("images/bg_skyblue.gif") left top repeat-x;border-bottom:1px solid #a4bed4;border-right:1px solid #a4bed4 !important;border-left:1px solid #fff !important;border-top:1px solid #fff !important}div.grd_tblCont table td{border-bottom:1px solid #a4bed4 !important;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:#cce2fe;color:#004a6f;border-top:1px solid #9cc !important;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#2d8eef;border:1px solid #cce2fe;border-radius:5px}.even{background-color:#fff}.odd{background-color:#e3efff}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ffdc61 !important;color:inherit}.ezSelectedRow{background-color:#ffe4ab !important;color:inherit}.ezActiveCell{background-color:#fff !important;color:#000 !important;font-weight:bold}.ezETSelectedCell{background-color:#fff !important;font-weight:bold;color:#000 !important}
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* tablefilter v0.1.3 by Max Guglielmi
|
||||
* build date: 2016-01-02T03:37:45.348Z
|
||||
* tablefilter v0.1.4 by Max Guglielmi
|
||||
* build date: 2016-01-02T14:26:21.070Z
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
|
|
|
@ -44,6 +44,7 @@ export class CheckList{
|
|||
this.excludedOpts = null;
|
||||
|
||||
this.tf = tf;
|
||||
this.emitter = tf.emitter;
|
||||
}
|
||||
|
||||
// TODO: move event here
|
||||
|
@ -65,13 +66,13 @@ export class CheckList{
|
|||
* @param {Boolean} isExternal Render in external container
|
||||
* @param {String} extFltId External container id
|
||||
*/
|
||||
build(colIndex, isExternal, extFltId){
|
||||
var tf = this.tf;
|
||||
tf.EvtManager(
|
||||
tf.Evt.name.checklist,
|
||||
{ slcIndex:colIndex, slcExternal:isExternal, slcId:extFltId }
|
||||
);
|
||||
}
|
||||
// build(colIndex, isExternal, extFltId){
|
||||
// var tf = this.tf;
|
||||
// tf.EvtManager(
|
||||
// tf.Evt.name.checklist,
|
||||
// { slcIndex:colIndex, slcExternal:isExternal, slcId:extFltId }
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Build checklist UI
|
||||
|
@ -79,10 +80,12 @@ export class CheckList{
|
|||
* @param {Boolean} isExternal Render in external container
|
||||
* @param {String} extFltId External container id
|
||||
*/
|
||||
_build(colIndex, isExternal=false, extFltId=null){
|
||||
build(colIndex, isExternal=false, extFltId=null){
|
||||
var tf = this.tf;
|
||||
colIndex = parseInt(colIndex, 10);
|
||||
|
||||
this.emitter.emit('before-populating-filter', tf, colIndex);
|
||||
|
||||
this.opts = [];
|
||||
this.optsTxt = [];
|
||||
|
||||
|
@ -227,6 +230,8 @@ export class CheckList{
|
|||
}
|
||||
flt.appendChild(ul);
|
||||
flt.setAttribute('filled', '1');
|
||||
|
||||
this.emitter.emit('after-populating-filter', tf, colIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,6 +32,7 @@ export class Dropdown{
|
|||
this.slcInnerHtml = null;
|
||||
|
||||
this.tf = tf;
|
||||
this.emitter = tf.emitter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -41,18 +42,18 @@ export class Dropdown{
|
|||
* @param {Boolean} isExternal Render in external container
|
||||
* @param {String} extSlcId External container id
|
||||
*/
|
||||
build(colIndex, isLinked, isExternal, extSlcId){
|
||||
var tf = this.tf;
|
||||
tf.EvtManager(
|
||||
tf.Evt.name.dropdown,
|
||||
{
|
||||
slcIndex: colIndex,
|
||||
slcRefreshed: isLinked,
|
||||
slcExternal: isExternal,
|
||||
slcId: extSlcId
|
||||
}
|
||||
);
|
||||
}
|
||||
// build(colIndex, isLinked, isExternal, extSlcId){
|
||||
// var tf = this.tf;
|
||||
// tf.EvtManager(
|
||||
// tf.Evt.name.dropdown,
|
||||
// {
|
||||
// slcIndex: colIndex,
|
||||
// slcRefreshed: isLinked,
|
||||
// slcExternal: isExternal,
|
||||
// slcId: extSlcId
|
||||
// }
|
||||
// );
|
||||
// }
|
||||
|
||||
/**
|
||||
* Build drop-down filter UI
|
||||
|
@ -61,10 +62,12 @@ export class Dropdown{
|
|||
* @param {Boolean} isExternal Render in external container
|
||||
* @param {String} extSlcId External container id
|
||||
*/
|
||||
_build(colIndex, isLinked=false, isExternal=false, extSlcId=null){
|
||||
build(colIndex, isLinked=false, isExternal=false, extSlcId=null){
|
||||
var tf = this.tf;
|
||||
colIndex = parseInt(colIndex, 10);
|
||||
|
||||
this.emitter.emit('before-populating-filter', tf, colIndex);
|
||||
|
||||
this.opts = [];
|
||||
this.optsTxt = [];
|
||||
this.slcInnerHtml = '';
|
||||
|
@ -226,6 +229,8 @@ export class Dropdown{
|
|||
//populates drop-down
|
||||
this.addOptions(
|
||||
colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr);
|
||||
|
||||
this.emitter.emit('after-populating-filter', tf, colIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,7 @@ import {Feature} from './feature';
|
|||
import Dom from '../dom';
|
||||
import Types from '../types';
|
||||
|
||||
var global = window;
|
||||
let global = window;
|
||||
|
||||
export class Loader extends Feature{
|
||||
|
||||
|
@ -10,11 +10,11 @@ export class Loader extends Feature{
|
|||
* Loading message/spinner
|
||||
* @param {Object} tf TableFilter instance
|
||||
*/
|
||||
constructor(tf){
|
||||
constructor(tf) {
|
||||
super(tf, 'loader');
|
||||
|
||||
// TableFilter configuration
|
||||
var f = this.config;
|
||||
let f = this.config;
|
||||
|
||||
//id of container element
|
||||
this.loaderTgtId = f.loader_target_id || null;
|
||||
|
@ -27,7 +27,7 @@ export class Loader extends Feature{
|
|||
//defines css class for loader div
|
||||
this.loaderCssClass = f.loader_css_class || 'loader';
|
||||
//delay for hiding loader
|
||||
this.loaderCloseDelay = 200;
|
||||
this.loaderCloseDelay = 250;
|
||||
//callback function before loader is displayed
|
||||
this.onShowLoader = Types.isFn(f.on_show_loader) ?
|
||||
f.on_show_loader : null;
|
||||
|
@ -43,12 +43,13 @@ export class Loader extends Feature{
|
|||
return;
|
||||
}
|
||||
|
||||
var tf = this.tf;
|
||||
let tf = this.tf;
|
||||
let emitter = this.emitter;
|
||||
|
||||
var containerDiv = Dom.create('div', ['id', this.prfxLoader+tf.id]);
|
||||
let containerDiv = Dom.create('div', ['id', this.prfxLoader+tf.id]);
|
||||
containerDiv.className = this.loaderCssClass;
|
||||
|
||||
var targetEl = !this.loaderTgtId ?
|
||||
let targetEl = !this.loaderTgtId ?
|
||||
tf.tbl.parentNode : Dom.id(this.loaderTgtId);
|
||||
if(!this.loaderTgtId){
|
||||
targetEl.insertBefore(containerDiv, tf.tbl);
|
||||
|
@ -63,15 +64,36 @@ export class Loader extends Feature{
|
|||
}
|
||||
|
||||
this.show('none');
|
||||
|
||||
// Subscribe to events
|
||||
emitter.on('before-filtering', ()=> this.show(''));
|
||||
emitter.on('after-filtering', ()=> this.show('none'));
|
||||
emitter.on('before-populating-filter', ()=> this.show(''));
|
||||
emitter.on('after-populating-filter', ()=> this.show('none'));
|
||||
emitter.on('before-changing-page', ()=> this.show(''));
|
||||
emitter.on('after-changing-page', ()=> this.show('none'));
|
||||
emitter.on('before-clearing-filters', ()=> this.show(''));
|
||||
emitter.on('after-clearing-filters', ()=> this.show('none'));
|
||||
emitter.on('before-changing-results-per-page', ()=> this.show(''));
|
||||
emitter.on('after-changing-results-per-page', ()=> this.show('none'));
|
||||
emitter.on('before-reset-page', ()=> this.show(''));
|
||||
emitter.on('after-reset-page', ()=> this.show('none'));
|
||||
emitter.on('before-reset-page-length', ()=> this.show(''));
|
||||
emitter.on('after-reset-page-length', ()=> this.show('none'));
|
||||
emitter.on('before-loading-extensions', ()=> this.show(''));
|
||||
emitter.on('after-loading-extensions', ()=> this.show('none'));
|
||||
emitter.on('before-loading-themes', ()=> this.show(''));
|
||||
emitter.on('after-loading-themes', ()=> this.show('none'));
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
show(p) {
|
||||
if(!this.isEnabled() || this.loaderDiv.style.display === p){
|
||||
if(!this.isEnabled() /*|| this.loaderDiv.style.display === p*/){
|
||||
return;
|
||||
}
|
||||
|
||||
var displayLoader = () => {
|
||||
let displayLoader = () => {
|
||||
if(!this.loaderDiv){
|
||||
return;
|
||||
}
|
||||
|
@ -84,17 +106,40 @@ export class Loader extends Feature{
|
|||
}
|
||||
};
|
||||
|
||||
var t = p === 'none' ? this.loaderCloseDelay : 1;
|
||||
let t = p === 'none' ? this.loaderCloseDelay : 1;
|
||||
global.setTimeout(displayLoader, t);
|
||||
}
|
||||
|
||||
destroy(){
|
||||
destroy() {
|
||||
if(!this.initialized){
|
||||
return;
|
||||
}
|
||||
|
||||
let emitter = this.emitter;
|
||||
|
||||
Dom.remove(this.loaderDiv);
|
||||
this.loaderDiv = null;
|
||||
|
||||
// Unsubscribe to events
|
||||
emitter.off('before-filtering', ()=> this.show(''));
|
||||
emitter.off('after-filtering', ()=> this.show('none'));
|
||||
emitter.off('before-populating-filter', ()=> this.show(''));
|
||||
emitter.off('after-populating-filter', ()=> this.show('none'));
|
||||
emitter.off('before-changing-page', ()=> this.show(''));
|
||||
emitter.off('after-changing-page', ()=> this.show('none'));
|
||||
emitter.off('before-clearing-filters', ()=> this.show(''));
|
||||
emitter.off('after-clearing-filters', ()=> this.show('none'));
|
||||
emitter.off('before-changing-results-per-page', ()=> this.show(''));
|
||||
emitter.off('after-changing-results-per-page', ()=> this.show('none'));
|
||||
emitter.off('before-reset-page', ()=> this.show(''));
|
||||
emitter.off('after-reset-page', ()=> this.show('none'));
|
||||
emitter.off('before-reset-page-length', ()=> this.show(''));
|
||||
emitter.off('after-reset-page-length', ()=> this.show('none'));
|
||||
emitter.off('before-loading-extensions', ()=> this.show(''));
|
||||
emitter.off('after-loading-extensions', ()=> this.show('none'));
|
||||
emitter.off('before-loading-themes', ()=> this.show(''));
|
||||
emitter.off('after-loading-themes', ()=> this.show('none'));
|
||||
|
||||
this.initialized = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,8 +120,8 @@ export class Paging extends Feature{
|
|||
//span following pages select (contains ' of ')
|
||||
this.prfxPgAfterSpan = 'pgafterspan_';
|
||||
|
||||
var start_row = this.refRow;
|
||||
var nrows = this.nbRows;
|
||||
var start_row = tf.refRow;
|
||||
var nrows = tf.nbRows;
|
||||
//calculates page nb
|
||||
this.nbPages = Math.ceil((nrows-start_row)/this.pagingLength);
|
||||
|
||||
|
@ -335,6 +335,7 @@ export class Paging extends Feature{
|
|||
}
|
||||
|
||||
this.emitter.on('after-filtering', ()=> this.resetPagingInfo());
|
||||
this.emitter.on('initialized', ()=> this.resetValues());
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
@ -565,49 +566,52 @@ export class Paging extends Feature{
|
|||
* Change the page asynchronously according to passed index
|
||||
* @param {Number} index Index of the page (0-n)
|
||||
*/
|
||||
changePage(index){
|
||||
var tf = this.tf;
|
||||
var evt = tf.Evt;
|
||||
tf.EvtManager(evt.name.changepage, { pgIndex:index });
|
||||
}
|
||||
// changePage(index){
|
||||
// var tf = this.tf;
|
||||
// var evt = tf.Evt;
|
||||
// tf.EvtManager(evt.name.changepage, { pgIndex:index });
|
||||
// }
|
||||
|
||||
/**
|
||||
* Change rows asynchronously according to page results
|
||||
*/
|
||||
changeResultsPerPage(){
|
||||
var tf = this.tf;
|
||||
var evt = tf.Evt;
|
||||
tf.EvtManager(evt.name.changeresultsperpage);
|
||||
}
|
||||
// changeResultsPerPage(){
|
||||
// var tf = this.tf;
|
||||
// var evt = tf.Evt;
|
||||
// tf.EvtManager(evt.name.changeresultsperpage);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Re-set asynchronously page nb at page re-load
|
||||
*/
|
||||
resetPage(){
|
||||
var tf = this.tf;
|
||||
var evt = tf.Evt;
|
||||
tf.EvtManager(evt.name.resetpage);
|
||||
}
|
||||
// resetPage(){
|
||||
// var tf = this.tf;
|
||||
// var evt = tf.Evt;
|
||||
// tf.EvtManager(evt.name.resetpage);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Re-set asynchronously page length at page re-load
|
||||
*/
|
||||
resetPageLength(){
|
||||
var tf = this.tf;
|
||||
var evt = tf.Evt;
|
||||
tf.EvtManager(evt.name.resetpagelength);
|
||||
}
|
||||
// resetPageLength(){
|
||||
// var tf = this.tf;
|
||||
// var evt = tf.Evt;
|
||||
// tf.EvtManager(evt.name.resetpagelength);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Change the page according to passed index
|
||||
* @param {Number} index Index of the page (0-n)
|
||||
*/
|
||||
_changePage(index){
|
||||
changePage(index){
|
||||
var tf = this.tf;
|
||||
|
||||
if(!this.isEnabled()){
|
||||
return;
|
||||
}
|
||||
|
||||
this.emitter.emit('before-changing-page', tf, index);
|
||||
|
||||
if(index === null){
|
||||
index = this.pageSelectorType===tf.fltTypeSlc ?
|
||||
this.pagingSlc.options.selectedIndex : (this.pagingSlc.value-1);
|
||||
|
@ -635,18 +639,23 @@ export class Paging extends Feature{
|
|||
this.onAfterChangePage.call(null, this, index);
|
||||
}
|
||||
}
|
||||
|
||||
this.emitter.emit('after-changing-page', tf, index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change rows according to page results drop-down
|
||||
* TODO: accept a parameter setting the results per page length
|
||||
*/
|
||||
_changeResultsPerPage(){
|
||||
changeResultsPerPage(){
|
||||
var tf = this.tf;
|
||||
|
||||
if(!this.isEnabled()){
|
||||
return;
|
||||
}
|
||||
|
||||
this.emitter.emit('before-changing-results-per-page', tf);
|
||||
|
||||
var slcR = this.resultsPerPageSlc;
|
||||
var slcPagesSelIndex = (this.pageSelectorType===tf.fltTypeSlc) ?
|
||||
this.pagingSlc.selectedIndex :
|
||||
|
@ -670,33 +679,55 @@ export class Paging extends Feature{
|
|||
tf.feature('store').savePageLength(tf.pgLenCookie);
|
||||
}
|
||||
}
|
||||
|
||||
this.emitter.emit('after-changing-results-per-page', tf);
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-set persisted pagination info
|
||||
*/
|
||||
resetValues(){
|
||||
var tf = this.tf;
|
||||
if(tf.rememberPageLen){
|
||||
this.resetPageLength(tf.pgLenCookie);
|
||||
}
|
||||
if(tf.rememberPageNb){
|
||||
this.resetPage(tf.pgNbCookie);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-set page nb at page re-load
|
||||
*/
|
||||
_resetPage(name){
|
||||
resetPage(name){
|
||||
var tf = this.tf;
|
||||
if(!this.isEnabled()){
|
||||
return;
|
||||
}
|
||||
this.emitter.emit('before-reset-page', tf);
|
||||
var pgnb = tf.feature('store').getPageNb(name);
|
||||
if(pgnb!==''){
|
||||
if(pgnb !== ''){
|
||||
this.changePage((pgnb-1));
|
||||
}
|
||||
this.emitter.emit('after-reset-page', tf, pgnb);
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-set page length value at page re-load
|
||||
*/
|
||||
_resetPageLength(name){
|
||||
resetPageLength(name){
|
||||
var tf = this.tf;
|
||||
if(!this.isEnabled()){
|
||||
return;
|
||||
}
|
||||
this.emitter.emit('before-reset-page-length', tf);
|
||||
var pglenIndex = tf.feature('store').getPageLength(name);
|
||||
|
||||
if(pglenIndex!==''){
|
||||
this.resultsPerPageSlc.options[pglenIndex].selected = true;
|
||||
this.changeResultsPerPage();
|
||||
}
|
||||
this.emitter.emit('after-reset-page-length', tf, pglenIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -769,6 +800,7 @@ export class Paging extends Feature{
|
|||
}
|
||||
|
||||
this.emitter.off('after-filtering', ()=> this.resetPagingInfo());
|
||||
this.emitter.off('initialized', ()=> this.resetValues());
|
||||
|
||||
this.pagingSlc = null;
|
||||
this.nbPages = 0;
|
||||
|
|
|
@ -2,7 +2,7 @@ import {Feature} from './feature';
|
|||
import Dom from '../dom';
|
||||
import Types from '../types';
|
||||
|
||||
var global = window;
|
||||
let global = window;
|
||||
|
||||
export class StatusBar extends Feature{
|
||||
|
||||
|
@ -14,7 +14,7 @@ export class StatusBar extends Feature{
|
|||
super(tf, 'statusBar');
|
||||
|
||||
// Configuration object
|
||||
var f = this.config;
|
||||
let f = this.config;
|
||||
|
||||
//id of custom container element
|
||||
this.statusBarTgtId = f.status_bar_target_id || null;
|
||||
|
@ -38,6 +38,36 @@ export class StatusBar extends Feature{
|
|||
this.onAfterShowMsg = Types.isFn(f.on_after_show_msg) ?
|
||||
f.on_after_show_msg : null;
|
||||
|
||||
//status messages
|
||||
this.msgFilter = f.msg_filter || 'Filtering data...';
|
||||
//populating drop-downs
|
||||
this.msgPopulate = f.msg_populate || 'Populating filter...';
|
||||
//populating drop-downs
|
||||
this.msgPopulateCheckList = f.msg_populate_checklist ||
|
||||
'Populating list...';
|
||||
//changing paging page
|
||||
this.msgChangePage = f.msg_change_page || 'Collecting paging data...';
|
||||
//clearing filters
|
||||
this.msgClear = f.msg_clear || 'Clearing filters...';
|
||||
//changing nb results/page
|
||||
this.msgChangeResults = f.msg_change_results ||
|
||||
'Changing results per page...';
|
||||
//re-setting grid values
|
||||
// this.msgResetValues = f.msg_reset_grid_values ||
|
||||
// 'Re-setting filters values...';
|
||||
//re-setting page
|
||||
this.msgResetPage = f.msg_reset_page || 'Re-setting page...';
|
||||
//re-setting page length
|
||||
this.msgResetPageLength = f.msg_reset_page_length ||
|
||||
'Re-setting page length...';
|
||||
//table sorting
|
||||
this.msgSort = f.msg_sort || 'Sorting data...';
|
||||
//extensions loading
|
||||
this.msgLoadExtensions = f.msg_load_extensions ||
|
||||
'Loading extensions...';
|
||||
//themes loading
|
||||
this.msgLoadThemes = f.msg_load_themes || 'Loading theme(s)...';
|
||||
|
||||
// status bar div
|
||||
this.prfxStatus = 'status_';
|
||||
// status bar label
|
||||
|
@ -51,16 +81,17 @@ export class StatusBar extends Feature{
|
|||
return;
|
||||
}
|
||||
|
||||
var tf = this.tf;
|
||||
let tf = this.tf;
|
||||
let emitter = this.emitter;
|
||||
|
||||
//status bar container
|
||||
var statusDiv = Dom.create('div', ['id', this.prfxStatus+tf.id]);
|
||||
let statusDiv = Dom.create('div', ['id', this.prfxStatus+tf.id]);
|
||||
statusDiv.className = this.statusBarCssClass;
|
||||
|
||||
//status bar label
|
||||
var statusSpan = Dom.create('span', ['id', this.prfxStatusSpan+tf.id]);
|
||||
let statusSpan = Dom.create('span', ['id', this.prfxStatusSpan+tf.id]);
|
||||
//preceding text
|
||||
var statusSpanText = Dom.create('span',
|
||||
let statusSpanText = Dom.create('span',
|
||||
['id', this.prfxStatusTxt+tf.id]);
|
||||
statusSpanText.appendChild(Dom.text(this.statusBarText));
|
||||
|
||||
|
@ -68,7 +99,7 @@ export class StatusBar extends Feature{
|
|||
if(!this.statusBarTgtId){
|
||||
tf.setToolbar();
|
||||
}
|
||||
var targetEl = (!this.statusBarTgtId) ?
|
||||
let targetEl = (!this.statusBarTgtId) ?
|
||||
tf.lDiv : Dom.id(this.statusBarTgtId);
|
||||
|
||||
//default container: 'lDiv'
|
||||
|
@ -86,6 +117,32 @@ export class StatusBar extends Feature{
|
|||
this.statusBarSpan = statusSpan;
|
||||
this.statusBarSpanText = statusSpanText;
|
||||
|
||||
// Subscribe to events
|
||||
emitter.on('before-filtering', ()=> this.message(this.msgFilter));
|
||||
emitter.on('after-filtering', ()=> this.message(''));
|
||||
emitter.on('before-populating-filter',
|
||||
()=> this.message(this.msgPopulate));
|
||||
emitter.on('after-populating-filter', ()=> this.message(''));
|
||||
emitter.on('before-changing-page',
|
||||
()=> this.message(this.msgChangePage));
|
||||
emitter.on('after-changing-page', ()=> this.message(''));
|
||||
emitter.on('before-clearing-filters', ()=> this.message(this.msgClear));
|
||||
emitter.on('after-clearing-filters', ()=> this.message(''));
|
||||
emitter.on('before-changing-results-per-page',
|
||||
()=> this.message(this.msgChangeResults));
|
||||
emitter.on('after-changing-results-per-page', ()=> this.message(''));
|
||||
emitter.on('before-reset-page', ()=> this.message(this.msgResetPage));
|
||||
emitter.on('after-reset-page', ()=> this.message(''));
|
||||
emitter.on('before-reset-page-length',
|
||||
()=> this.message(this.msgResetPageLength));
|
||||
emitter.on('after-reset-page-length', ()=> this.message(''));
|
||||
emitter.on('before-loading-extensions',
|
||||
()=> this.message(this.msgLoadExtensions));
|
||||
emitter.on('after-loading-extensions', ()=> this.message(''));
|
||||
emitter.on('before-loading-themes',
|
||||
()=> this.message(this.msgLoadThemes));
|
||||
emitter.on('after-loading-themes', ()=> this.message(''));
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
|
@ -98,8 +155,11 @@ export class StatusBar extends Feature{
|
|||
this.onBeforeShowMsg.call(null, this.tf, t);
|
||||
}
|
||||
|
||||
var d = t==='' ? this.statusBarCloseDelay : 1;
|
||||
let d = t==='' ? this.statusBarCloseDelay : 1;
|
||||
global.setTimeout(() => {
|
||||
if(!this.initialized){
|
||||
return;
|
||||
}
|
||||
this.statusBarSpan.innerHTML = t;
|
||||
if(this.onAfterShowMsg){
|
||||
this.onAfterShowMsg.call(null, this.tf, t);
|
||||
|
@ -112,11 +172,41 @@ export class StatusBar extends Feature{
|
|||
return;
|
||||
}
|
||||
|
||||
let emitter = this.emitter;
|
||||
|
||||
this.statusBarDiv.innerHTML = '';
|
||||
Dom.remove(this.statusBarDiv);
|
||||
this.statusBarSpan = null;
|
||||
this.statusBarSpanText = null;
|
||||
this.statusBarDiv = null;
|
||||
|
||||
// Unsubscribe to events
|
||||
emitter.off('before-filtering', ()=> this.message(this.msgFilter));
|
||||
emitter.off('after-filtering', ()=> this.message(''));
|
||||
emitter.off('before-populating-filter',
|
||||
()=> this.message(this.msgPopulate));
|
||||
emitter.off('after-populating-filter', ()=> this.message(''));
|
||||
emitter.off('before-changing-page',
|
||||
()=> this.message(this.msgChangePage));
|
||||
emitter.off('after-changing-page', ()=> this.message(''));
|
||||
emitter.off('before-clearing-filters',
|
||||
()=> this.message(this.msgClear));
|
||||
emitter.off('after-clearing-filters', ()=> this.message(''));
|
||||
emitter.off('before-changing-results-per-page',
|
||||
()=> this.message(this.msgChangeResults));
|
||||
emitter.off('after-changing-results-per-page', ()=> this.message(''));
|
||||
emitter.off('before-reset-page', ()=> this.message(this.msgResetPage));
|
||||
emitter.off('after-reset-page', ()=> this.message(''));
|
||||
emitter.off('before-reset-page-length',
|
||||
()=> this.message(this.msgResetPageLength));
|
||||
emitter.off('after-reset-page-length', ()=> this.message(''));
|
||||
emitter.off('before-loading-extensions',
|
||||
()=> this.message(this.msgLoadExtensions));
|
||||
emitter.off('after-loading-extensions', ()=> this.message(''));
|
||||
emitter.off('before-loading-themes',
|
||||
()=> this.message(this.msgLoadThemes));
|
||||
emitter.off('after-loading-themes', ()=> this.message(''));
|
||||
|
||||
this.initialized = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -370,34 +370,34 @@ export class TableFilter {
|
|||
|
||||
/*** status messages ***/
|
||||
//filtering
|
||||
this.msgFilter = f.msg_filter || 'Filtering data...';
|
||||
//populating drop-downs
|
||||
this.msgPopulate = f.msg_populate || 'Populating filter...';
|
||||
//populating drop-downs
|
||||
this.msgPopulateCheckList = f.msg_populate_checklist ||
|
||||
'Populating list...';
|
||||
//changing paging page
|
||||
this.msgChangePage = f.msg_change_page || 'Collecting paging data...';
|
||||
//clearing filters
|
||||
this.msgClear = f.msg_clear || 'Clearing filters...';
|
||||
//changing nb results/page
|
||||
this.msgChangeResults = f.msg_change_results ||
|
||||
'Changing results per page...';
|
||||
//re-setting grid values
|
||||
this.msgResetValues = f.msg_reset_grid_values ||
|
||||
'Re-setting filters values...';
|
||||
//re-setting page
|
||||
this.msgResetPage = f.msg_reset_page || 'Re-setting page...';
|
||||
//re-setting page length
|
||||
this.msgResetPageLength = f.msg_reset_page_length ||
|
||||
'Re-setting page length...';
|
||||
//table sorting
|
||||
this.msgSort = f.msg_sort || 'Sorting data...';
|
||||
//extensions loading
|
||||
this.msgLoadExtensions = f.msg_load_extensions ||
|
||||
'Loading extensions...';
|
||||
//themes loading
|
||||
this.msgLoadThemes = f.msg_load_themes || 'Loading theme(s)...';
|
||||
// this.msgFilter = f.msg_filter || 'Filtering data...';
|
||||
// //populating drop-downs
|
||||
// this.msgPopulate = f.msg_populate || 'Populating filter...';
|
||||
// //populating drop-downs
|
||||
// this.msgPopulateCheckList = f.msg_populate_checklist ||
|
||||
// 'Populating list...';
|
||||
// //changing paging page
|
||||
//this.msgChangePage = f.msg_change_page || 'Collecting paging data...';
|
||||
// //clearing filters
|
||||
// this.msgClear = f.msg_clear || 'Clearing filters...';
|
||||
// //changing nb results/page
|
||||
// this.msgChangeResults = f.msg_change_results ||
|
||||
// 'Changing results per page...';
|
||||
// //re-setting grid values
|
||||
// this.msgResetValues = f.msg_reset_grid_values ||
|
||||
// 'Re-setting filters values...';
|
||||
// //re-setting page
|
||||
// this.msgResetPage = f.msg_reset_page || 'Re-setting page...';
|
||||
// //re-setting page length
|
||||
// this.msgResetPageLength = f.msg_reset_page_length ||
|
||||
// 'Re-setting page length...';
|
||||
// //table sorting
|
||||
// this.msgSort = f.msg_sort || 'Sorting data...';
|
||||
// //extensions loading
|
||||
// this.msgLoadExtensions = f.msg_load_extensions ||
|
||||
// 'Loading extensions...';
|
||||
// //themes loading
|
||||
// this.msgLoadThemes = f.msg_load_themes || 'Loading theme(s)...';
|
||||
|
||||
/*** ids prefixes ***/
|
||||
//css class name added to table
|
||||
|
@ -457,19 +457,19 @@ export class TableFilter {
|
|||
|
||||
/*** TF events ***/
|
||||
this.Evt = {
|
||||
name: {
|
||||
filter: 'Filter',
|
||||
dropdown: 'DropDown',
|
||||
checklist: 'CheckList',
|
||||
changepage: 'ChangePage',
|
||||
clear: 'Clear',
|
||||
changeresultsperpage: 'ChangeResults',
|
||||
resetvalues: 'ResetValues',
|
||||
resetpage: 'ResetPage',
|
||||
resetpagelength: 'ResetPageLength',
|
||||
loadextensions: 'LoadExtensions',
|
||||
loadthemes: 'LoadThemes'
|
||||
},
|
||||
// name: {
|
||||
// //filter: 'Filter',
|
||||
// //dropdown: 'DropDown',
|
||||
// // checklist: 'CheckList',
|
||||
// // changepage: 'ChangePage',
|
||||
// // clear: 'Clear',
|
||||
// // changeresultsperpage: 'ChangeResults',
|
||||
// // resetvalues: 'ResetValues',
|
||||
// // resetpage: 'ResetPage',
|
||||
// // resetpagelength: 'ResetPageLength',
|
||||
// // loadextensions: 'LoadExtensions',
|
||||
// // loadthemes: 'LoadThemes'
|
||||
// },
|
||||
|
||||
// Detect <enter> key
|
||||
detectKey(e) {
|
||||
|
@ -573,7 +573,7 @@ export class TableFilter {
|
|||
// select is populated when element has focus
|
||||
if(this.loadFltOnDemand && elm.getAttribute('filled') === '0'){
|
||||
let ct = elm.getAttribute('ct');
|
||||
this.Mod.dropdown._build(ct);
|
||||
this.Mod.dropdown.build(ct);
|
||||
}
|
||||
if(this.popupFilters){
|
||||
Event.cancel(_ev);
|
||||
|
@ -593,7 +593,7 @@ export class TableFilter {
|
|||
let elm = Event.target(_ev);
|
||||
if(this.loadFltOnDemand && elm.getAttribute('filled') === '0'){
|
||||
let ct = elm.getAttribute('ct');
|
||||
this.Mod.checkList._build(ct);
|
||||
this.Mod.checkList.build(ct);
|
||||
this.Mod.checkList.checkListDiv[ct].onclick = null;
|
||||
this.Mod.checkList.checkListDiv[ct].title = '';
|
||||
}
|
||||
|
@ -759,7 +759,7 @@ export class TableFilter {
|
|||
this.fltIds.push(this.prfxFlt+i+'_'+this.id);
|
||||
|
||||
if(!this.loadFltOnDemand){
|
||||
dropdown._build(i);
|
||||
dropdown.build(i);
|
||||
}
|
||||
|
||||
Event.add(slc, 'keypress',
|
||||
|
@ -797,7 +797,7 @@ export class TableFilter {
|
|||
checkList.checkListDiv[i] = divCont;
|
||||
this.fltIds.push(this.prfxFlt+i+'_'+this.id);
|
||||
if(!this.loadFltOnDemand){
|
||||
checkList._build(i);
|
||||
checkList.build(i);
|
||||
}
|
||||
|
||||
if(this.loadFltOnDemand){
|
||||
|
@ -958,80 +958,81 @@ export class TableFilter {
|
|||
* @param {String} evt Event name
|
||||
* @param {Object} cfg Config object
|
||||
*/
|
||||
EvtManager(evt,
|
||||
cfg={ slcIndex: null, slcExternal: false, slcId: null, pgIndex: null }){
|
||||
let slcIndex = cfg.slcIndex;
|
||||
let slcExternal = cfg.slcExternal;
|
||||
let slcId = cfg.slcId;
|
||||
let pgIndex = cfg.pgIndex;
|
||||
let cpt = this.Mod;
|
||||
// EvtManager(evt/*,
|
||||
// cfg={ slcIndex: null, slcExternal: false, slcId: null, pgIndex: null }
|
||||
// */){
|
||||
// // let slcIndex = cfg.slcIndex;
|
||||
// // let slcExternal = cfg.slcExternal;
|
||||
// // let slcId = cfg.slcId;
|
||||
// // let pgIndex = cfg.pgIndex;
|
||||
// let cpt = this.Mod;
|
||||
|
||||
function efx(){
|
||||
/*jshint validthis:true */
|
||||
let ev = this.Evt.name;
|
||||
// function efx(){
|
||||
// /*jshint validthis:true */
|
||||
// // let ev = this.Evt.name;
|
||||
|
||||
switch(evt){
|
||||
case ev.filter:
|
||||
this._filter();
|
||||
break;
|
||||
case ev.dropdown:
|
||||
if(this.linkedFilters){
|
||||
cpt.dropdown._build(slcIndex, true);
|
||||
} else {
|
||||
cpt.dropdown._build(
|
||||
slcIndex, false, slcExternal, slcId);
|
||||
}
|
||||
break;
|
||||
case ev.checklist:
|
||||
cpt.checkList._build(slcIndex, slcExternal, slcId);
|
||||
break;
|
||||
case ev.changepage:
|
||||
cpt.paging._changePage(pgIndex);
|
||||
break;
|
||||
case ev.clear:
|
||||
this._clearFilters();
|
||||
this._filter();
|
||||
break;
|
||||
case ev.changeresultsperpage:
|
||||
cpt.paging._changeResultsPerPage();
|
||||
break;
|
||||
case ev.resetvalues:
|
||||
this._resetValues();
|
||||
this._filter();
|
||||
break;
|
||||
case ev.resetpage:
|
||||
cpt.paging._resetPage(this.pgNbCookie);
|
||||
break;
|
||||
case ev.resetpagelength:
|
||||
cpt.paging._resetPageLength(this.pgLenCookie);
|
||||
break;
|
||||
case ev.loadextensions:
|
||||
this._loadExtensions();
|
||||
break;
|
||||
case ev.loadthemes:
|
||||
this._loadThemes();
|
||||
break;
|
||||
}
|
||||
if(this.statusBar){
|
||||
cpt.statusBar.message('');
|
||||
}
|
||||
if(this.loader){
|
||||
cpt.loader.show('none');
|
||||
}
|
||||
}
|
||||
// // switch(evt){
|
||||
// // case ev.filter:
|
||||
// // this._filter();
|
||||
// // break;
|
||||
// // case ev.dropdown:
|
||||
// // if(this.linkedFilters){
|
||||
// // cpt.dropdown._build(slcIndex, true);
|
||||
// // } else {
|
||||
// // cpt.dropdown._build(
|
||||
// // slcIndex, false, slcExternal, slcId);
|
||||
// // }
|
||||
// // break;
|
||||
// // case ev.checklist:
|
||||
// // cpt.checkList._build(slcIndex, slcExternal, slcId);
|
||||
// // break;
|
||||
// // case ev.changepage:
|
||||
// // cpt.paging._changePage(pgIndex);
|
||||
// // break;
|
||||
// // case ev.clear:
|
||||
// // this._clearFilters();
|
||||
// // this.filter();
|
||||
// // break;
|
||||
// // case ev.changeresultsperpage:
|
||||
// // cpt.paging._changeResultsPerPage();
|
||||
// // break;
|
||||
// // case ev.resetvalues:
|
||||
// // this._resetValues();
|
||||
// // this.filter();
|
||||
// // break;
|
||||
// // case ev.resetpage:
|
||||
// // cpt.paging._resetPage(this.pgNbCookie);
|
||||
// // break;
|
||||
// // case ev.resetpagelength:
|
||||
// // cpt.paging._resetPageLength(this.pgLenCookie);
|
||||
// // break;
|
||||
// // case ev.loadextensions:
|
||||
// // this._loadExtensions();
|
||||
// // break;
|
||||
// // case ev.loadthemes:
|
||||
// // this._loadThemes();
|
||||
// // break;
|
||||
// // }
|
||||
// if(this.statusBar){
|
||||
// cpt.statusBar.message('');
|
||||
// }
|
||||
// if(this.loader){
|
||||
// cpt.loader.show('none');
|
||||
// }
|
||||
// }
|
||||
|
||||
if(!this.loader && !this.statusBar && !this.linkedFilters) {
|
||||
efx.call(this);
|
||||
} else {
|
||||
if(this.loader){
|
||||
cpt.loader.show('');
|
||||
}
|
||||
if(this.statusBar){
|
||||
cpt.statusBar.message(this['msg'+evt]);
|
||||
}
|
||||
global.setTimeout(efx.bind(this), this.execDelay);
|
||||
}
|
||||
}
|
||||
// if(!this.loader && !this.statusBar && !this.linkedFilters) {
|
||||
// efx.call(this);
|
||||
// } else {
|
||||
// if(this.loader){
|
||||
// cpt.loader.show('');
|
||||
// }
|
||||
// if(this.statusBar){
|
||||
// cpt.statusBar.message(this['msg'+evt]);
|
||||
// }
|
||||
// global.setTimeout(efx.bind(this), this.execDelay);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return a feature instance for a given name
|
||||
|
@ -1048,12 +1049,14 @@ export class TableFilter {
|
|||
initExtensions(){
|
||||
let exts = this.extensions;
|
||||
|
||||
this.emitter.emit('before-loading-extensions', this);
|
||||
for(let i=0, len=exts.length; i<len; i++){
|
||||
let ext = exts[i];
|
||||
if(!this.ExtRegistry[ext.name]){
|
||||
this.loadExtension(ext);
|
||||
}
|
||||
}
|
||||
this.emitter.emit('after-loading-extensions', this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1120,15 +1123,17 @@ export class TableFilter {
|
|||
}
|
||||
}
|
||||
|
||||
loadThemes(){
|
||||
this.EvtManager(this.Evt.name.loadthemes);
|
||||
}
|
||||
// loadThemes(){
|
||||
// this.EvtManager(this.Evt.name.loadthemes);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Load themes defined in the configuration object
|
||||
*/
|
||||
_loadThemes(){
|
||||
loadThemes(){
|
||||
let themes = this.themes;
|
||||
this.emitter.emit('before-loading-themes', this);
|
||||
|
||||
//Default theme config
|
||||
if(this.enableDefaultTheme){
|
||||
let defaultTheme = { name: 'default' };
|
||||
|
@ -1173,6 +1178,8 @@ export class TableFilter {
|
|||
this.loader = true;
|
||||
this.loaderHtml = '<div class="defaultLoader"></div>';
|
||||
this.loaderText = null;
|
||||
|
||||
this.emitter.emit('after-loading-themes', this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1193,7 +1200,7 @@ export class TableFilter {
|
|||
let rows = this.tbl.rows,
|
||||
Mod = this.Mod;
|
||||
|
||||
this._clearFilters();
|
||||
this.clearFilters();
|
||||
|
||||
if(this.isExternalFlt && !this.popupFilters){
|
||||
this.removeExternalFlts();
|
||||
|
@ -1396,24 +1403,25 @@ export class TableFilter {
|
|||
return [optArray, optTxt];
|
||||
}
|
||||
|
||||
resetValues(){
|
||||
this.EvtManager(this.Evt.name.resetvalues);
|
||||
}
|
||||
// resetValues(){
|
||||
// this.EvtManager(this.Evt.name.resetvalues);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Reset persisted filter values
|
||||
*/
|
||||
_resetValues(){
|
||||
resetValues(){
|
||||
//only loadFltOnDemand
|
||||
if(this.rememberGridValues && this.loadFltOnDemand){
|
||||
this._resetGridValues(this.fltsValuesCookie);
|
||||
}
|
||||
if(this.rememberPageLen && this.Mod.paging){
|
||||
this.Mod.paging.resetPageLength(this.pgLenCookie);
|
||||
}
|
||||
if(this.rememberPageNb && this.Mod.paging){
|
||||
this.Mod.paging.resetPage(this.pgNbCookie);
|
||||
}
|
||||
// if(this.rememberPageLen && this.Mod.paging){
|
||||
// this.Mod.paging.resetPageLength(this.pgLenCookie);
|
||||
// }
|
||||
// if(this.rememberPageNb && this.Mod.paging){
|
||||
// this.Mod.paging.resetPage(this.pgNbCookie);
|
||||
// }
|
||||
this.filter();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1501,9 +1509,9 @@ export class TableFilter {
|
|||
}//end if
|
||||
}
|
||||
|
||||
filter(){
|
||||
this.EvtManager(this.Evt.name.filter);
|
||||
}
|
||||
// filter(){
|
||||
// this.EvtManager(this.Evt.name.filter);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Filter the table by retrieving the data from each cell in every single
|
||||
|
@ -1512,7 +1520,7 @@ export class TableFilter {
|
|||
*
|
||||
* TODO: Reduce complexity of this massive method
|
||||
*/
|
||||
_filter(){
|
||||
filter(){
|
||||
if(!this.fltGrid || (!this._hasGrid && !this.isFirstLoad)){
|
||||
return;
|
||||
}
|
||||
|
@ -2323,17 +2331,20 @@ export class TableFilter {
|
|||
}
|
||||
}
|
||||
|
||||
clearFilters(){
|
||||
this.EvtManager(this.Evt.name.clear);
|
||||
}
|
||||
// clearFilters(){
|
||||
// // this.EvtManager(this.Evt.name.clear);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Clear all the filters' values
|
||||
*/
|
||||
_clearFilters(){
|
||||
clearFilters(){
|
||||
if(!this.fltGrid){
|
||||
return;
|
||||
}
|
||||
|
||||
this.emitter.emit('before-clearing-filters', this);
|
||||
|
||||
if(this.onBeforeReset){
|
||||
this.onBeforeReset.call(null, this, this.getFiltersValue());
|
||||
}
|
||||
|
@ -2347,7 +2358,9 @@ export class TableFilter {
|
|||
if(this.rememberPageNb){ Cookie.remove(this.pgNbCookie); }
|
||||
if(this.onAfterReset){ this.onAfterReset.call(null, this); }
|
||||
|
||||
this.emitter.emit('cleared-filters', this);
|
||||
this.filter();
|
||||
|
||||
this.emitter.emit('after-clearing-filters', this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2423,9 +2436,9 @@ export class TableFilter {
|
|||
}
|
||||
|
||||
if(slcA3.indexOf(slcIndex[i]) != -1){
|
||||
this.Mod.checkList._build(slcIndex[i]);
|
||||
this.Mod.checkList.build(slcIndex[i]);
|
||||
} else {
|
||||
this.Mod.dropdown._build(slcIndex[i], true);
|
||||
this.Mod.dropdown.build(slcIndex[i], true);
|
||||
}
|
||||
|
||||
this.setFilterValue(slcIndex[i], slcSelectedValue);
|
||||
|
|
|
@ -14,25 +14,25 @@
|
|||
module('Behaviour');
|
||||
test('After filtering with `sydney`', function() {
|
||||
tf.setFilterValue(0, 'sydney');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
deepEqual(tf.getValidRows().length, 0, 'No matches');
|
||||
});
|
||||
|
||||
test('After filtering with `Sydney`', function() {
|
||||
tf.setFilterValue(0, 'Sydney');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
deepEqual(tf.getValidRows().length>0, true, 'Matches');
|
||||
});
|
||||
|
||||
test('After filtering with `ade`', function() {
|
||||
tf.setFilterValue(0, 'ade');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
deepEqual(tf.getValidRows().length, 0, 'No matches');
|
||||
});
|
||||
|
||||
test('After filtering with `Ade`', function() {
|
||||
tf.setFilterValue(0, 'Ade');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
deepEqual(tf.getValidRows().length>0, true, 'Matches');
|
||||
});
|
||||
|
||||
|
|
|
@ -14,13 +14,13 @@
|
|||
module('Behaviour');
|
||||
test('After filtering with `syd`', function() {
|
||||
tf.setFilterValue(0, 'syd');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
deepEqual(tf.getValidRows().length, 0, 'No matches');
|
||||
});
|
||||
|
||||
test('After filtering with `sydney`', function() {
|
||||
tf.setFilterValue(0, 'sydney');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
deepEqual(tf.getValidRows().length>0, true, 'Matches');
|
||||
});
|
||||
|
||||
|
@ -42,14 +42,14 @@
|
|||
test('After filtering with `syd`', function() {
|
||||
tf.setFilterValue(0, 'syd');
|
||||
tf.setFilterValue(1, 'bris');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
deepEqual(tf.getValidRows().length, 0, 'No matches');
|
||||
});
|
||||
|
||||
test('After filtering with `sydney`', function() {
|
||||
tf.clearFilters();
|
||||
tf.setFilterValue(0, 'sydney');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
deepEqual(tf.getValidRows().length>0, true, 'Matches');
|
||||
});
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@ test('HighlightKeyword component', function() {
|
|||
test('Highlighted keywords', function() {
|
||||
tf.setFilterValue(1, 'Perth');
|
||||
tf.setFilterValue(3, '3.1');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
deepEqual(highlightKeyword.highlightedNodes.length,
|
||||
2, 'Number of highlighted words');
|
||||
|
||||
tf._clearFilters();
|
||||
tf._filter();
|
||||
tf.clearFilters();
|
||||
tf.filter();
|
||||
deepEqual(highlightKeyword.highlightedNodes.length,
|
||||
0, 'Number of highlighted words');
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ test('Highlighted keywords', function() {
|
|||
module('Tear-down');
|
||||
test('can destroy TableFilter DOM elements', function() {
|
||||
tf.setFilterValue(1, 'Perth');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
tf.destroy();
|
||||
deepEqual(tf.hasGrid(), false, 'Filters removed');
|
||||
deepEqual(highlightKeyword.highlightedNodes.length,
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
tf.init();
|
||||
tf.setFilterValue(0, 'Sydney');
|
||||
tf.getFilterElement(0).focus();
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
|
||||
module('Sanity checks');
|
||||
test('Linked filters feature', function() {
|
||||
deepEqual(tf instanceof TableFilter, true, 'TableFilter instantiated');
|
||||
deepEqual(tf.linkedFilters, true, 'Linked filters enabled');
|
||||
|
||||
tf._clearFilters();
|
||||
tf.clearFilters();
|
||||
tf.onAfterFilter = null;
|
||||
tf.destroy();
|
||||
tf = null;
|
||||
|
@ -54,7 +54,7 @@
|
|||
tf.init();
|
||||
tf.setFilterValue(0, 'Sydney');
|
||||
tf.getFilterElement(0).focus();
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
}
|
||||
|
||||
function testExcludedOptions(tf){
|
||||
|
@ -75,7 +75,7 @@
|
|||
});
|
||||
|
||||
tf.onAfterFilter = null;
|
||||
tf.clearFilters();
|
||||
setTimeout(tf.clearFilters, 0);
|
||||
}
|
||||
|
||||
// Tests for https://github.com/koalyptus/TableFilter/pull/42 issue
|
||||
|
|
|
@ -18,7 +18,7 @@ var flt3Cont = id(flt3ContId);
|
|||
|
||||
function buildChecklist(tf, colIdx){
|
||||
var checkList = tf.feature('checkList');
|
||||
checkList._build(colIdx);
|
||||
checkList.build(colIdx);
|
||||
checkList.checkListDiv[colIdx].onclick = null;
|
||||
checkList.checkListDiv[colIdx].title = '';
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ test('No Results Feature', function() {
|
|||
module('Behaviour');
|
||||
test('Can display no results message', function() {
|
||||
tf.setFilterValue(0, 'sadasd');
|
||||
tf._filter();
|
||||
tf.filter();
|
||||
deepEqual(tf.getValidRows().length, 0, 'Filtered rows number');
|
||||
deepEqual(noResults.cont.innerHTML, 'No results', 'No results message');
|
||||
deepEqual(noResults.cont.style.display, 'block',
|
||||
|
@ -107,7 +107,7 @@ test('External container sanity checks', function() {
|
|||
|
||||
test('Can display external no results message', function() {
|
||||
tfCustom.setFilterValue(0, 'sadasd');
|
||||
tfCustom._filter();
|
||||
tfCustom.filter();
|
||||
deepEqual(noResultsCustom.cont.innerHTML, '<h3>No results found</h3>',
|
||||
'No results message markup');
|
||||
deepEqual(noResultsCustom.cont.style.display, 'block',
|
||||
|
@ -147,7 +147,7 @@ test('Sanity checks', function() {
|
|||
|
||||
test('Can display no results message in grid layout', function() {
|
||||
tfGl.setFilterValue(0, 'sadasd');
|
||||
tfGl._filter();
|
||||
tfGl.filter();
|
||||
deepEqual(noResultsGl.cont.innerHTML, 'No results',
|
||||
'No results message');
|
||||
deepEqual(noResultsGl.cont.style.display, 'block',
|
||||
|
|
Loading…
Reference in New Issue