mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-06-01 05:23:02 +02:00
Merge pull request #89 from koalyptus/issue-88-remove-evtmanager
Issue 88 remove evtmanager
This commit is contained in:
commit
ba7228cca1
|
@ -11,7 +11,7 @@
|
|||
"trailing": true,
|
||||
"quotmark": "single",
|
||||
"immed": true,
|
||||
"maxstatements": 198,
|
||||
"maxstatements": 178,
|
||||
"maxdepth": 7,
|
||||
"maxcomplexity": 104
|
||||
"maxcomplexity": 87
|
||||
}
|
4
dist/starter.html
vendored
4
dist/starter.html
vendored
|
@ -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>
|
||||
|
||||
|
||||
|
||||
|
|
4
dist/tablefilter/style/colsVisibility.css
vendored
4
dist/tablefilter/style/colsVisibility.css
vendored
|
@ -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-03T02:53:59.298Z
|
||||
* 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}
|
4
dist/tablefilter/style/filtersVisibility.css
vendored
4
dist/tablefilter/style/filtersVisibility.css
vendored
|
@ -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-03T02:53:59.298Z
|
||||
* 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}
|
4
dist/tablefilter/style/tablefilter.css
vendored
4
dist/tablefilter/style/tablefilter.css
vendored
|
@ -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-03T02:53:59.298Z
|
||||
* 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-03T02:53:59.298Z
|
||||
* 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-03T02:53:59.298Z
|
||||
* 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-03T02:53:59.298Z
|
||||
* 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}
|
12
dist/tablefilter/tablefilter.js
vendored
12
dist/tablefilter/tablefilter.js
vendored
File diff suppressed because one or more lines are too long
6
dist/tablefilter/tf-1.js
vendored
6
dist/tablefilter/tf-1.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tablefilter",
|
||||
"version": "0.1.3",
|
||||
"version": "0.1.4",
|
||||
"description": "A Javascript library making HTML tables filterable and a bit more",
|
||||
"license": "MIT",
|
||||
"author": {
|
||||
|
|
|
@ -12,23 +12,27 @@ export class Emitter {
|
|||
|
||||
/**
|
||||
* Subscribe to an event
|
||||
* @param {String} evt Event name
|
||||
* @param {Array} evts Collection of event names
|
||||
* @param {Function} fn Function invoked when event is emitted
|
||||
*/
|
||||
on(evt, fn) {
|
||||
this.events[evt] = this.events[evt] || [];
|
||||
this.events[evt].push(fn);
|
||||
on(evts, fn) {
|
||||
evts.forEach((evt)=> {
|
||||
this.events[evt] = this.events[evt] || [];
|
||||
this.events[evt].push(fn);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsubscribe to an event
|
||||
* @param {String} evt Event name
|
||||
* @param {Array} evts Collection of event names
|
||||
* @param {Function} fn Function invoked when event is emitted
|
||||
*/
|
||||
off(evt, fn) {
|
||||
if(evt in this.events) {
|
||||
this.events[evt].splice(this.events[evt].indexOf(fn), 1);
|
||||
}
|
||||
off(evts, fn) {
|
||||
evts.forEach((evt)=> {
|
||||
if(evt in this.events) {
|
||||
this.events[evt].splice(this.events[evt].indexOf(fn), 1);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -37,11 +41,10 @@ export class Emitter {
|
|||
* the invoked function
|
||||
*/
|
||||
emit(evt /*, args...*/) {
|
||||
if(evt in this.events === false) {
|
||||
return;
|
||||
}
|
||||
for(var i = 0; i < this.events[evt].length; i++) {
|
||||
this.events[evt][i].apply(this, [].slice.call(arguments, 1));
|
||||
if(evt in this.events) {
|
||||
for(let i = 0; i < this.events[evt].length; i++) {
|
||||
this.events[evt][i].apply(this, [].slice.call(arguments, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ export default class ColOps{
|
|||
|
||||
init(){
|
||||
// subscribe to events
|
||||
this.tf.emitter.on('after-filtering', ()=> this.calc());
|
||||
this.tf.emitter.on(['after-filtering'], ()=> this.calc());
|
||||
|
||||
this.calc();
|
||||
}
|
||||
|
@ -315,7 +315,7 @@ export default class ColOps{
|
|||
|
||||
destroy(){
|
||||
// unsubscribe to events
|
||||
this.tf.emitter.off('after-filtering', ()=> this.calc());
|
||||
this.tf.emitter.off(['after-filtering'], ()=> this.calc());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ export default class AdapterSortableTable{
|
|||
opts.on_after_sort : null;
|
||||
|
||||
this.tf = tf;
|
||||
this.emitter = this.tf.emitter;
|
||||
this.emitter = tf.emitter;
|
||||
}
|
||||
|
||||
init(){
|
||||
|
|
|
@ -27,11 +27,11 @@ export class AlternateRows extends Feature {
|
|||
|
||||
this.processAll();
|
||||
|
||||
this.emitter.on('row-processed', (tf, rowIndex, arrIndex, isValid)=>
|
||||
this.processRow(rowIndex, arrIndex, isValid));
|
||||
this.emitter.on('row-paged', (tf, rowIndex, arrIndex, isValid)=>
|
||||
this.processRow(rowIndex, arrIndex, isValid));
|
||||
this.emitter.on('column-sorted', ()=> this.processAll());
|
||||
// Subscribe to events
|
||||
this.emitter.on(['row-processed', 'row-paged'],
|
||||
(tf, rowIndex, arrIndex, isValid)=>
|
||||
this.processRow(rowIndex, arrIndex, isValid));
|
||||
this.emitter.on(['column-sorted'], ()=> this.processAll());
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
@ -116,11 +116,11 @@ export class AlternateRows extends Feature {
|
|||
this.removeRowBg(i);
|
||||
}
|
||||
|
||||
this.emitter.off('row-processed', (tf, rowIndex, arrIndex, isValid)=>
|
||||
this.processRow(rowIndex, arrIndex, isValid));
|
||||
this.emitter.off('row-paged', (tf, rowIndex, arrIndex, isValid)=>
|
||||
this.processRow(rowIndex, arrIndex, isValid));
|
||||
this.emitter.off('column-sorted', ()=> this.processAll());
|
||||
// Unsubscribe to events
|
||||
this.emitter.off(['row-processed', 'row-paged'],
|
||||
(tf, rowIndex, arrIndex, isValid)=>
|
||||
this.processRow(rowIndex, arrIndex, isValid));
|
||||
this.emitter.off(['column-sorted'], ()=> this.processAll());
|
||||
|
||||
this.initialized = false;
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ export class CheckList{
|
|||
this.excludedOpts = null;
|
||||
|
||||
this.tf = tf;
|
||||
this.emitter = tf.emitter;
|
||||
}
|
||||
|
||||
// TODO: move event here
|
||||
|
@ -59,30 +60,18 @@ export class CheckList{
|
|||
this.onChange(evt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build checklist UI asynchronously
|
||||
* @param {Number} colIndex Column index
|
||||
* @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 checklist UI
|
||||
* @param {Number} colIndex Column index
|
||||
* @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 +216,8 @@ export class CheckList{
|
|||
}
|
||||
flt.appendChild(ul);
|
||||
flt.setAttribute('filled', '1');
|
||||
|
||||
this.emitter.emit('after-populating-filter', tf, colIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -258,10 +249,10 @@ export class CheckList{
|
|||
li.className = this.checkListItemCssClass;
|
||||
if(tf.linkedFilters && tf.disableExcludedOptions &&
|
||||
Arr.has(this.excludedOpts,
|
||||
Str.matchCase(val, tf.matchCase), tf.matchCase)){
|
||||
Dom.addClass(li, this.checkListItemDisabledCssClass);
|
||||
li.check.disabled = true;
|
||||
li.disabled = true;
|
||||
Str.matchCase(val, tf.matchCase), tf.matchCase)){
|
||||
Dom.addClass(li, this.checkListItemDisabledCssClass);
|
||||
li.check.disabled = true;
|
||||
li.disabled = true;
|
||||
} else {
|
||||
Event.add(li.check, 'click',
|
||||
(evt) => { this.optionClick(evt); });
|
||||
|
|
|
@ -32,26 +32,7 @@ export class Dropdown{
|
|||
this.slcInnerHtml = null;
|
||||
|
||||
this.tf = tf;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build drop-down filter UI asynchronously
|
||||
* @param {Number} colIndex Column index
|
||||
* @param {Boolean} isLinked Enable linked refresh behaviour
|
||||
* @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
|
||||
}
|
||||
);
|
||||
this.emitter = tf.emitter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,10 +42,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 +209,8 @@ export class Dropdown{
|
|||
//populates drop-down
|
||||
this.addOptions(
|
||||
colIndex, slc, isLinked, excludedOpts, fltsValues, fltArr);
|
||||
|
||||
this.emitter.emit('after-populating-filter', tf, colIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -18,7 +18,7 @@ export class HighlightKeyword{
|
|||
}
|
||||
|
||||
init(){
|
||||
this.emitter.on('before-filtering', ()=> this.unhighlightAll());
|
||||
this.emitter.on(['before-filtering'], ()=> this.unhighlightAll());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -112,6 +112,6 @@ export class HighlightKeyword{
|
|||
}
|
||||
|
||||
destroy(){
|
||||
this.emitter.off('before-filtering', ()=> this.unhighlightAll());
|
||||
this.emitter.off(['before-filtering'], ()=> this.unhighlightAll());
|
||||
}
|
||||
}
|
|
@ -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,44 @@ export class Loader extends Feature{
|
|||
}
|
||||
|
||||
this.show('none');
|
||||
|
||||
// Subscribe to events
|
||||
emitter.on([
|
||||
'before-filtering',
|
||||
'before-populating-filter',
|
||||
'before-changing-page',
|
||||
'before-clearing-filters',
|
||||
'before-changing-results-per-page',
|
||||
'before-reset-page',
|
||||
'before-reset-page-length',
|
||||
'before-loading-extensions',
|
||||
'before-loading-themes'
|
||||
],
|
||||
()=> this.show('')
|
||||
);
|
||||
emitter.on([
|
||||
'after-filtering',
|
||||
'after-populating-filter',
|
||||
'after-changing-page',
|
||||
'after-clearing-filters',
|
||||
'after-changing-results-per-page',
|
||||
'after-reset-page',
|
||||
'after-reset-page-length',
|
||||
'after-loading-extensions',
|
||||
'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 +114,48 @@ 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',
|
||||
'before-populating-filter',
|
||||
'before-changing-page',
|
||||
'before-clearing-filters',
|
||||
'before-changing-results-per-page',
|
||||
'before-reset-page',
|
||||
'before-reset-page-length',
|
||||
'before-loading-extensions',
|
||||
'before-loading-themes'
|
||||
],
|
||||
()=> this.show('')
|
||||
);
|
||||
emitter.off([
|
||||
'after-filtering',
|
||||
'after-populating-filter',
|
||||
'after-changing-page',
|
||||
'after-clearing-filters',
|
||||
'after-changing-results-per-page',
|
||||
'after-reset-page',
|
||||
'after-reset-page-length',
|
||||
'after-loading-extensions',
|
||||
'after-loading-themes'
|
||||
],
|
||||
()=> this.show('none')
|
||||
);
|
||||
|
||||
this.initialized = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ export class NoResults extends Feature{
|
|||
this.cont = cont;
|
||||
|
||||
// subscribe to after-filtering event
|
||||
this.emitter.on('after-filtering', ()=> this.toggle());
|
||||
this.emitter.on(['after-filtering'], ()=> this.toggle());
|
||||
|
||||
this.initialized = true;
|
||||
this.hide();
|
||||
|
@ -128,7 +128,8 @@ export class NoResults extends Feature{
|
|||
Dom.remove(this.cont);
|
||||
this.cont = null;
|
||||
// unsubscribe to after-filtering event
|
||||
this.emitter.off('after-filtering', ()=> this.toggle());
|
||||
this.emitter.off(['after-filtering'], ()=> this.toggle());
|
||||
|
||||
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);
|
||||
|
||||
|
@ -334,7 +334,8 @@ export class Paging extends Feature{
|
|||
this.setPagingInfo(tf.validRowsIndex);
|
||||
}
|
||||
|
||||
this.emitter.on('after-filtering', ()=> this.resetPagingInfo());
|
||||
this.emitter.on(['after-filtering'], ()=> this.resetPagingInfo());
|
||||
this.emitter.on(['initialized'], ()=> this.resetValues());
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
@ -561,53 +562,19 @@ export class Paging extends Feature{
|
|||
this.resultsPerPageSlc = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 });
|
||||
}
|
||||
|
||||
/**
|
||||
* Change rows asynchronously according to page results
|
||||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Re-set asynchronously page length at page re-load
|
||||
*/
|
||||
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 +602,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 +642,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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -768,7 +762,8 @@ export class Paging extends Feature{
|
|||
this.removeResultsPerPage();
|
||||
}
|
||||
|
||||
this.emitter.off('after-filtering', ()=> this.resetPagingInfo());
|
||||
this.emitter.off(['after-filtering'], ()=> this.resetPagingInfo());
|
||||
this.emitter.off(['initialized'], ()=> this.resetValues());
|
||||
|
||||
this.pagingSlc = null;
|
||||
this.nbPages = 0;
|
||||
|
|
|
@ -102,9 +102,9 @@ export class PopupFilter extends Feature{
|
|||
}
|
||||
|
||||
// subscribe to events
|
||||
this.emitter.on('before-filtering', ()=> this.buildIcons());
|
||||
this.emitter.on('after-filtering', ()=> this.closeAll());
|
||||
this.emitter.on('cell-processed',
|
||||
this.emitter.on(['before-filtering'], ()=> this.buildIcons());
|
||||
this.emitter.on(['after-filtering'], ()=> this.closeAll());
|
||||
this.emitter.on(['cell-processed'],
|
||||
(tf, cellIndex)=> this.buildIcon(cellIndex, true));
|
||||
|
||||
this.initialized = true;
|
||||
|
@ -253,9 +253,9 @@ export class PopupFilter extends Feature{
|
|||
this.popUpFltImgs = [];
|
||||
|
||||
// unsubscribe to events
|
||||
this.emitter.off('before-filtering', ()=> this.buildIcons());
|
||||
this.emitter.off('after-filtering', ()=> this.closeAll());
|
||||
this.emitter.off('cell-processed',
|
||||
this.emitter.off(['before-filtering'], ()=> this.buildIcons());
|
||||
this.emitter.off(['after-filtering'], ()=> this.closeAll());
|
||||
this.emitter.off(['cell-processed'],
|
||||
(tf, cellIndex)=> this.buildIcon(cellIndex, true));
|
||||
|
||||
this.initialized = false;
|
||||
|
|
|
@ -76,12 +76,10 @@ export class RowsCounter extends Feature{
|
|||
this.rowsCounterDiv = countDiv;
|
||||
this.rowsCounterSpan = countSpan;
|
||||
|
||||
// subscribe to after-filtering event
|
||||
this.emitter.on('after-filtering', ()=> this.refresh(tf.nbVisibleRows));
|
||||
// subscribe to grouped-by-page event
|
||||
this.emitter.on('grouped-by-page', ()=> this.refresh(tf.nbVisibleRows));
|
||||
// subscribe to rows-changed event
|
||||
this.emitter.on('rows-changed', ()=> this.refresh());
|
||||
// subscribe to events
|
||||
this.emitter.on(['after-filtering', 'grouped-by-page'],
|
||||
()=> this.refresh(tf.nbVisibleRows));
|
||||
this.emitter.on(['rows-changed'], ()=> this.refresh());
|
||||
|
||||
this.initialized = true;
|
||||
this.refresh();
|
||||
|
@ -141,15 +139,9 @@ export class RowsCounter extends Feature{
|
|||
this.rowsCounterDiv = null;
|
||||
|
||||
// unsubscribe to events
|
||||
this.emitter.off(
|
||||
'after-filtering',
|
||||
()=> this.refresh(tf.nbVisibleRows)
|
||||
);
|
||||
this.emitter.off(
|
||||
'grouped-by-page',
|
||||
()=> this.refresh(tf.nbVisibleRows)
|
||||
);
|
||||
this.emitter.off('rows-changed', ()=> this.refresh());
|
||||
this.emitter.off(['after-filtering', 'grouped-by-page'],
|
||||
()=> this.refresh(tf.nbVisibleRows));
|
||||
this.emitter.off(['rows-changed'], ()=> this.refresh());
|
||||
|
||||
this.initialized = false;
|
||||
}
|
||||
|
|
|
@ -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,33 @@ 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 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 +78,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 +96,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 +114,38 @@ export class StatusBar extends Feature{
|
|||
this.statusBarSpan = statusSpan;
|
||||
this.statusBarSpanText = statusSpanText;
|
||||
|
||||
// Subscribe to events
|
||||
emitter.on(['before-filtering'], ()=> this.message(this.msgFilter));
|
||||
emitter.on(['before-populating-filter'],
|
||||
()=> this.message(this.msgPopulate));
|
||||
emitter.on(['before-changing-page'],
|
||||
()=> this.message(this.msgChangePage));
|
||||
emitter.on(['before-clearing-filters'], ()=>
|
||||
this.message(this.msgClear));
|
||||
emitter.on(['before-changing-results-per-page'],
|
||||
()=> this.message(this.msgChangeResults));
|
||||
emitter.on(['before-reset-page'], ()=> this.message(this.msgResetPage));
|
||||
emitter.on(['before-reset-page-length'],
|
||||
()=> this.message(this.msgResetPageLength));
|
||||
emitter.on(['before-loading-extensions'],
|
||||
()=> this.message(this.msgLoadExtensions));
|
||||
emitter.on(['before-loading-themes'],
|
||||
()=> this.message(this.msgLoadThemes));
|
||||
|
||||
emitter.on([
|
||||
'after-filtering',
|
||||
'after-populating-filter',
|
||||
'after-changing-page',
|
||||
'after-clearing-filters',
|
||||
'after-changing-results-per-page',
|
||||
'after-reset-page',
|
||||
'after-reset-page-length',
|
||||
'after-loading-extensions',
|
||||
'after-loading-themes'
|
||||
],
|
||||
()=> this.message('')
|
||||
);
|
||||
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
|
@ -98,8 +158,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 +175,47 @@ 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(['before-populating-filter'],
|
||||
()=> this.message(this.msgPopulate));
|
||||
emitter.off(['before-changing-page'],
|
||||
()=> this.message(this.msgChangePage));
|
||||
emitter.off(['before-clearing-filters'],
|
||||
()=> this.message(this.msgClear));
|
||||
emitter.off(['before-changing-results-per-page'],
|
||||
()=> this.message(this.msgChangeResults));
|
||||
emitter.off(['before-reset-page'], ()=>
|
||||
this.message(this.msgResetPage));
|
||||
emitter.off(['before-reset-page-length'],
|
||||
()=> this.message(this.msgResetPageLength));
|
||||
emitter.off(['before-loading-extensions'],
|
||||
()=> this.message(this.msgLoadExtensions));
|
||||
emitter.off(['before-loading-themes'],
|
||||
()=> this.message(this.msgLoadThemes));
|
||||
|
||||
emitter.off([
|
||||
'after-filtering',
|
||||
'after-populating-filter',
|
||||
'after-changing-page',
|
||||
'after-clearing-filters',
|
||||
'after-changing-results-per-page',
|
||||
'after-reset-page',
|
||||
'after-reset-page-length',
|
||||
'after-loading-extensions',
|
||||
'after-loading-themes'
|
||||
],
|
||||
()=> this.message('')
|
||||
);
|
||||
|
||||
this.initialized = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ export class Store{
|
|||
}
|
||||
|
||||
init(){
|
||||
this.emitter.on('after-filtering',
|
||||
this.emitter.on(['after-filtering'],
|
||||
()=> this.saveFilterValues(this.tf.fltsValuesCookie));
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ export class Store{
|
|||
}
|
||||
|
||||
destroy(){
|
||||
this.emitter.off('after-filtering',
|
||||
this.emitter.off(['after-filtering'],
|
||||
()=> this.saveFilterValues(this.tf.fltsValuesCookie));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -368,37 +368,6 @@ export class TableFilter {
|
|||
//array containing columns date type
|
||||
this.colDateType = this.hasColDateType ? f.col_date_type : null;
|
||||
|
||||
/*** 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)...';
|
||||
|
||||
/*** ids prefixes ***/
|
||||
//css class name added to table
|
||||
this.prfxTf = 'TF';
|
||||
|
@ -457,20 +426,6 @@ 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'
|
||||
},
|
||||
|
||||
// Detect <enter> key
|
||||
detectKey(e) {
|
||||
if(!this.enterKey){ return; }
|
||||
|
@ -573,7 +528,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 +548,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 = '';
|
||||
}
|
||||
|
@ -630,7 +585,7 @@ export class TableFilter {
|
|||
this.import(this.stylesheetId, this.stylesheet, null, 'link');
|
||||
|
||||
//loads theme
|
||||
if(this.hasThemes){ this._loadThemes(); }
|
||||
if(this.hasThemes){ this.loadThemes(); }
|
||||
|
||||
if(this.rememberGridValues || this.rememberPageNb ||
|
||||
this.rememberPageLen){
|
||||
|
@ -759,7 +714,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 +752,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){
|
||||
|
@ -876,7 +831,7 @@ export class TableFilter {
|
|||
|
||||
/* Features */
|
||||
if(this.hasVisibleRows){
|
||||
this.emitter.on('after-filtering', ()=> this.enforceVisibility());
|
||||
this.emitter.on(['after-filtering'], ()=> this.enforceVisibility());
|
||||
this.enforceVisibility();
|
||||
}
|
||||
if(this.rowsCounter){
|
||||
|
@ -938,12 +893,13 @@ export class TableFilter {
|
|||
|
||||
// Subscribe to events
|
||||
if(this.markActiveColumns){
|
||||
this.emitter.on('before-filtering', ()=> this.clearActiveColumns());
|
||||
this.emitter.on('cell-processed',
|
||||
this.emitter.on(['before-filtering'],
|
||||
()=> this.clearActiveColumns());
|
||||
this.emitter.on(['cell-processed'],
|
||||
(tf, colIndex)=> this.markActiveColumn(colIndex));
|
||||
}
|
||||
if(this.linkedFilters){
|
||||
this.emitter.on('after-filtering', ()=> this.linkFilters());
|
||||
this.emitter.on(['after-filtering'], ()=> this.linkFilters());
|
||||
}
|
||||
|
||||
if(this.onFiltersLoaded){
|
||||
|
@ -953,86 +909,6 @@ export class TableFilter {
|
|||
this.emitter.emit('initialized', this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Manages state messages
|
||||
* @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;
|
||||
|
||||
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');
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
* @param {String} name Name of the feature
|
||||
|
@ -1048,12 +924,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 +998,13 @@ export class TableFilter {
|
|||
}
|
||||
}
|
||||
|
||||
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 +1049,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 +1071,7 @@ export class TableFilter {
|
|||
let rows = this.tbl.rows,
|
||||
Mod = this.Mod;
|
||||
|
||||
this._clearFilters();
|
||||
this.clearFilters();
|
||||
|
||||
if(this.isExternalFlt && !this.popupFilters){
|
||||
this.removeExternalFlts();
|
||||
|
@ -1206,9 +1084,9 @@ export class TableFilter {
|
|||
}
|
||||
if(this.markActiveColumns){
|
||||
this.clearActiveColumns();
|
||||
this.emitter.off('before-filtering',
|
||||
this.emitter.off(['before-filtering'],
|
||||
()=> this.clearActiveColumns());
|
||||
this.emitter.off('cell-processed',
|
||||
this.emitter.off(['cell-processed'],
|
||||
(tf, colIndex)=> this.markActiveColumn(colIndex));
|
||||
}
|
||||
if(this.hasExtensions){
|
||||
|
@ -1241,10 +1119,11 @@ export class TableFilter {
|
|||
|
||||
// unsubscribe to events
|
||||
if(this.hasVisibleRows){
|
||||
this.emitter.off('after-filtering', ()=> this.enforceVisibility());
|
||||
this.emitter.off(['after-filtering'],
|
||||
()=> this.enforceVisibility());
|
||||
}
|
||||
if(this.linkedFilters){
|
||||
this.emitter.off('after-filtering', ()=> this.linkFilters());
|
||||
this.emitter.off(['after-filtering'], ()=> this.linkFilters());
|
||||
}
|
||||
|
||||
Dom.removeClass(this.tbl, this.prfxTf);
|
||||
|
@ -1396,24 +1275,15 @@ export class TableFilter {
|
|||
return [optArray, optTxt];
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
this.filter();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1501,10 +1371,6 @@ export class TableFilter {
|
|||
}//end if
|
||||
}
|
||||
|
||||
filter(){
|
||||
this.EvtManager(this.Evt.name.filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter the table by retrieving the data from each cell in every single
|
||||
* row and comparing it to the search term for current column. A row is
|
||||
|
@ -1512,7 +1378,7 @@ export class TableFilter {
|
|||
*
|
||||
* TODO: Reduce complexity of this massive method
|
||||
*/
|
||||
_filter(){
|
||||
filter(){
|
||||
if(!this.fltGrid || (!this._hasGrid && !this.isFirstLoad)){
|
||||
return;
|
||||
}
|
||||
|
@ -2323,17 +2189,16 @@ export class TableFilter {
|
|||
}
|
||||
}
|
||||
|
||||
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 +2212,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 +2290,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);
|
||||
|
@ -2457,6 +2324,8 @@ export class TableFilter {
|
|||
} else {
|
||||
filtersRow.parentNode.insertBefore(this.fltGridEl, filtersRow);
|
||||
}
|
||||
|
||||
Dom.addClass(tbl, this.prfxTf);
|
||||
}
|
||||
|
||||
// filters are appended in external placeholders elements
|
||||
|
@ -2495,9 +2364,6 @@ export class TableFilter {
|
|||
Mod.popupFilter.reset();
|
||||
}
|
||||
|
||||
if(!this.gridLayout){
|
||||
Dom.addClass(this.tbl, this.prfxTf);
|
||||
}
|
||||
this._hasGrid = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
|
||||
|
|
|
@ -17,7 +17,8 @@ module('Behaviour');
|
|||
test('Can subscribe', function(){
|
||||
var emitter = tf.emitter;
|
||||
var output = null;
|
||||
emitter.on('before-filtering', function(){ output = 'before-filtering'; });
|
||||
emitter.on(['before-filtering'],
|
||||
function(){ output = 'before-filtering'; });
|
||||
|
||||
tf.filter();
|
||||
|
||||
|
@ -29,7 +30,8 @@ test('Can subscribe', function(){
|
|||
test('Can unsubscribe', function(){
|
||||
var emitter = tf.emitter;
|
||||
var output = null;
|
||||
emitter.off('before-filtering', function(){ output = 'before-filtering'; });
|
||||
emitter.off(['before-filtering'],
|
||||
function(){ output = 'before-filtering'; });
|
||||
|
||||
tf.filter();
|
||||
|
||||
|
@ -41,7 +43,7 @@ test('Can unsubscribe', function(){
|
|||
test('Can emit', function(){
|
||||
var emitter = tf.emitter;
|
||||
var output = null;
|
||||
emitter.on('hello', function(arg){ output = arg; });
|
||||
emitter.on(['hello'], function(arg){ output = arg; });
|
||||
|
||||
emitter.emit('hello', 'world');
|
||||
|
||||
|
|
|
@ -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 a new issue