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

Merge pull request #60 from koalyptus/feature-base-class

Feature base class
This commit is contained in:
koalyptus 2015-11-21 18:59:59 +11:00
commit 4f2316a4b5
55 changed files with 730 additions and 253 deletions

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Editable Grid Demo</title>
<title>tablefilter v0.0.11 - Editable Grid Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Editable grid demo</h2>
<p>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Selection Grid Demo</title>
<title>tablefilter v0.0.11 - Selection Grid Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Selection grid demo</h2>
<p>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Auto-filter Demo</title>
<title>tablefilter v0.0.11 - Auto-filter Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Auto-filter demo</h2>
<p>
This demo features the auto-filter behaviour, the table is filtered as soon

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Columns Visibility Extension Demo</title>
<title>tablefilter v0.0.11 - Columns Visibility Extension Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -28,7 +28,7 @@
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/colsVisibility.css">
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Columns visibility extension demo</h2>
<p>
This demo features the columns visibility extension.

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Data types Demo</title>
<title>tablefilter v0.0.11 - Data types Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Data types demo</h2>
<p>This example features 3 date types and 2 numeric formatting for the currency

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Demo</title>
<title>tablefilter v0.0.11 - Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<pre></pre>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Filters Visibility Extension Demo</title>
<title>tablefilter v0.0.11 - Filters Visibility Extension Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Filters visibility extension demo</h2>
<p>
This demo features the filters visibility extension.

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - External Filters Demo</title>
<title>tablefilter v0.0.11 - External Filters Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>External filters demo</h2>
<p>
This demo shows how generate the column filters in an external container.

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Filter and Sort Images Demo</title>
<title>tablefilter v0.0.11 - Filter and Sort Images Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Filter and sort images demo</h2>
<p>
This demo shows how to filter and sort a column containing images by using

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Filters Visibility Extension Demo</title>
<title>tablefilter v0.0.11 - Filters Visibility Extension Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Filters visibility extension demo</h2>
<p>
This demo features the filters visibility extension.

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Grid Layout Demo</title>
<title>tablefilter v0.0.11 - Grid Layout Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Grid layout demo</h2>
<pre></pre>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Grouped Headers Demo</title>
<title>tablefilter v0.0.11 - Grouped Headers Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Grouped headers demo</h2>
<p>
With grouped and/or multi-line headers, to place the filters row at desired

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Linked filters Demo</title>
<title>tablefilter v0.0.11 - Linked filters Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Linked filters with disabled options demo</h2>
<p>
This demo features the refresh filters behaviour. In this mode, the

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Linked filters Demo</title>
<title>tablefilter v0.0.11 - Linked filters Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Linked filters demo</h2>
<p>
This demo features the linked filters behaviour. In this mode, the drop-down

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Load filters on demand Demo</title>
<title>tablefilter v0.0.11 - Load filters on demand Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Load filters on demand demo</h2>
<p>
The filter options are loaded only when used for the first time.

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Pagination Demo</title>
<title>tablefilter v0.0.11 - Pagination Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -42,7 +42,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Pagination demo</h2>
<pre></pre>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Development workflow with RequireJs</title>
<title>tablefilter v0.0.11 - Development workflow with RequireJs</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Development workflow with RequireJs</h2>
<p>
To take advantage of the RequireJs development workflow use the

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - RequireJs demo</title>
<title>tablefilter v0.0.11 - RequireJs demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>RequireJs Demo</h2>
<pre></pre>

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Theme Roller Demo</title>
<title>tablefilter v0.0.11 - Theme Roller Demo</title>
<link rel="stylesheet" type="text/css" href="../dist/tablefilter/style/tablefilter.css">
<style type="text/css">
body{
@ -27,7 +27,7 @@
</style>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>
<h2>Theme roller demo</h2>
<p>
This demo shows how to implement a theme roller.

4
dist/starter.html vendored
View file

@ -1,10 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>tablefilter v0.0.10 - Starter</title>
<title>tablefilter v0.0.11 - Starter</title>
</head>
<body>
<h1>tablefilter v0.0.10</h1>
<h1>tablefilter v0.0.11</h1>

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.0.10 by Max Guglielmi
* build date: 2015-11-07T07:53:16.525Z
* tablefilter v0.0.11 by Max Guglielmi
* build date: 2015-11-21T07:50:21.705Z
* 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}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.0.10 by Max Guglielmi
* build date: 2015-11-07T07:53:16.525Z
* tablefilter v0.0.11 by Max Guglielmi
* build date: 2015-11-21T07:50:21.705Z
* 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}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.0.10 by Max Guglielmi
* build date: 2015-11-07T07:53:16.525Z
* tablefilter v0.0.11 by Max Guglielmi
* build date: 2015-11-21T07:50:21.705Z
* MIT License
*/
.activeHeader{background-color:#66afe9 !important;color:#fff !important}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.0.10 by Max Guglielmi
* build date: 2015-11-07T07:53:16.525Z
* tablefilter v0.0.11 by Max Guglielmi
* build date: 2015-11-21T07:50:21.705Z
* 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}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.0.10 by Max Guglielmi
* build date: 2015-11-07T07:53:16.525Z
* tablefilter v0.0.11 by Max Guglielmi
* build date: 2015-11-21T07:50:21.705Z
* 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}

View file

@ -1,6 +1,6 @@
/**
* tablefilter v0.0.10 by Max Guglielmi
* build date: 2015-11-07T07:53:16.525Z
* tablefilter v0.0.11 by Max Guglielmi
* build date: 2015-11-21T07:50:21.705Z
* 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

File diff suppressed because one or more lines are too long

View file

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

View file

@ -302,7 +302,7 @@ export default class AdapterEzEditTable {
tf.feature('paging').destroy();
tf.feature('paging').reset();
}
if(tf.alternateBgs){
if(tf.alternateRows){
tf.feature('alternateRows').init();
}
if(fnE){
@ -323,7 +323,7 @@ export default class AdapterEzEditTable {
tf.feature('paging').destroy();
tf.feature('paging').reset(false);
}
if(tf.alternateBgs){
if(tf.alternateRows){
tf.feature('alternateRows').init();
}
if(fnF){

View file

@ -41,7 +41,7 @@ export default class AdapterSortableTable{
/*** TF additional events ***/
//additional paging events for alternating background
// o.Evt._Paging.nextEvt = function(){
// if(o.sorted && o.alternateBgs) o.Filter();
// if(o.sorted && o.alternateRows) o.Filter();
// }
// o.Evt._Paging.prevEvt = o.Evt._Paging.nextEvt;
// o.Evt._Paging.firstEvt = o.Evt._Paging.nextEvt;
@ -102,7 +102,7 @@ export default class AdapterSortableTable{
//rows alternating bg issue
// TODO: move into AlternateRows component
if(tf.alternateBgs){
if(tf.alternateRows){
let rows = tf.tbl.rows, c = 0;
let setClass = function(row, i, removeOnly){

View file

@ -1,29 +1,31 @@
import {Feature} from './feature';
import Dom from '../dom';
export class AlternateRows{
export class AlternateRows extends Feature {
/**
* Alternating rows color
* @param {Object} tf TableFilter instance
*/
constructor(tf) {
var f = tf.config();
//defines css class for even rows
this.evenCss = f.even_row_css_class || 'even';
//defines css class for odd rows
this.oddCss = f.odd_row_css_class || 'odd';
super(tf, 'alternateRows');
this.tf = tf;
var config = this.config;
//defines css class for even rows
this.evenCss = config.even_row_css_class || 'even';
//defines css class for odd rows
this.oddCss = config.odd_row_css_class || 'odd';
}
/**
* Sets alternating rows color
*/
init() {
var tf = this.tf;
if(!tf.hasGrid() && !tf.isFirstLoad){
if(this.initialized){
return;
}
var tf = this.tf;
var validRowsIndex = tf.validRowsIndex;
var noValidRowsIndex = validRowsIndex===null;
//1st index
@ -40,6 +42,7 @@ export class AlternateRows{
this.setRowBg(rowIdx, idx);
idx++;
}
this.initialized = true;
}
/**
@ -49,7 +52,7 @@ export class AlternateRows{
* color
*/
setRowBg(rowIdx, idx) {
if(!this.tf.alternateBgs || isNaN(rowIdx)){
if(!this.isEnabled() || isNaN(rowIdx)){
return;
}
var rows = this.tf.tbl.rows;
@ -78,22 +81,15 @@ export class AlternateRows{
/**
* Removes all alternating backgrounds
*/
remove() {
if(!this.tf.hasGrid()){
destroy() {
if(!this.initialized){
return;
}
for(var i=this.tf.refRow; i<this.tf.nbRows; i++){
this.removeRowBg(i);
}
}
enable() {
this.tf.alternateBgs = true;
}
disable() {
this.tf.alternateBgs = false;
this.disable();
this.initialized = false;
}
}

View file

@ -1,15 +1,18 @@
import {Feature} from './feature';
import Dom from '../dom';
import Event from '../event';
export class ClearButton{
export class ClearButton extends Feature{
/**
* Clear button component
* @param {Object} tf TableFilter instance
*/
constructor(tf){
super(tf, 'btnReset');
// Configuration object
var f = tf.config();
var f = this.config;
//id of container element
this.btnResetTgtId = f.btn_reset_target_id || null;
@ -26,11 +29,12 @@ export class ClearButton{
'title="'+this.btnResetTooltip+'" />');
//span containing reset button
this.prfxResetSpan = 'resetspan_';
this.tf = tf;
}
onClick(){
if(!this.isEnabled()){
return;
}
this.tf.clearFilters();
}
@ -40,7 +44,7 @@ export class ClearButton{
init(){
var tf = this.tf;
if(!tf.hasGrid() && !tf.isFirstLoad && tf.btnResetEl){
if(this.initialized){
return;
}
@ -59,15 +63,15 @@ export class ClearButton{
fltreset.className = tf.btnResetCssClass;
fltreset.appendChild(Dom.text(this.btnResetText));
resetspan.appendChild(fltreset);
// fltreset.onclick = this.Evt._Clear;
Event.add(fltreset, 'click', () => { this.onClick(); });
Event.add(fltreset, 'click', ()=> { this.onClick(); });
} else {
resetspan.innerHTML = this.btnResetHtml;
var resetEl = resetspan.firstChild;
// resetEl.onclick = this.Evt._Clear;
Event.add(resetEl, 'click', () => { this.onClick(); });
Event.add(resetEl, 'click', ()=> { this.onClick(); });
}
this.btnResetEl = resetspan.firstChild;
this.initialized = true;
}
/**
@ -76,14 +80,16 @@ export class ClearButton{
destroy(){
var tf = this.tf;
if(!tf.hasGrid() || !this.btnResetEl){
if(!this.initialized){
return;
}
var resetspan = Dom.id(tf.prfxResetSpan+tf.id);
var resetspan = Dom.id(this.prfxResetSpan+tf.id);
if(resetspan){
resetspan.parentNode.removeChild(resetspan);
}
this.btnResetEl = null;
this.disable();
this.initialized = false;
}
}

37
src/modules/feature.js Normal file
View file

@ -0,0 +1,37 @@
const NOTIMPLEMENTED = 'Not implemented.';
export class Feature {
constructor(tf, feature) {
this.tf = tf;
this.feature = feature;
this.enabled = tf[feature];
this.config = tf.config();
this.initialized = false;
}
init() {
throw new Error(NOTIMPLEMENTED);
}
reset() {
this.enable();
this.init();
}
destroy() {
throw new Error(NOTIMPLEMENTED);
}
enable() {
this.enabled = true;
}
disable() {
this.enabled = false;
}
isEnabled() {
return this.enabled;
}
}

View file

@ -1,15 +1,18 @@
import {Feature} from './feature';
import Dom from '../dom';
import Types from '../types';
import Event from '../event';
export class GridLayout{
export class GridLayout extends Feature{
/**
* Grid layout, table with fixed headers
* @param {Object} tf TableFilter instance
*/
constructor(tf) {
var f = tf.config();
constructor(tf){
super(tf, 'gridLayout');
var f = this.config;
//defines grid width
this.gridWidth = f.grid_width || null;
@ -50,8 +53,6 @@ export class GridLayout{
this.prfxGridTh = 'tblHeadTh_';
this.sourceTblHtml = tf.tbl.outerHTML;
this.tf = tf;
}
/**
@ -59,10 +60,10 @@ export class GridLayout{
*/
init(){
var tf = this.tf;
var f = tf.config();
var f = this.config;
var tbl = tf.tbl;
if(!tf.gridLayout){
if(this.initialized){
return;
}
@ -148,7 +149,7 @@ export class GridLayout{
//Headers table
this.headTbl = Dom.create('table', ['id', this.prfxHeadTbl + tf.id]);
var tH = Dom.create('tHead'); //IE<7 needs it
var tH = Dom.create('tHead');
//1st row should be headers row, ids are added if not set
//Those ids are used by the sort feature
@ -293,13 +294,15 @@ export class GridLayout{
}
};
if(tf.popUpFilters){
if(tf.popupFilters){
filtersRow.style.display = 'none';
}
if(tbl.clientWidth !== this.headTbl.clientWidth){
tbl.style.width = this.headTbl.clientWidth+'px';
}
this.initialized = true;
}
/**
@ -309,7 +312,7 @@ export class GridLayout{
var tf = this.tf;
var tbl = tf.tbl;
if(!tf.gridLayout){
if(!this.initialized){
return;
}
var t = tbl.parentNode.removeChild(tbl);
@ -323,6 +326,8 @@ export class GridLayout{
tbl.outerHTML = this.sourceTblHtml;
//needed to keep reference of table element
tbl = Dom.id(tf.id);
this.tf.tbl = Dom.id(tf.id); // ???
this.initialized = false;
}
}
}

View file

@ -1,3 +1,4 @@
import {Feature} from './feature';
import Dom from '../dom';
import Event from '../event';
@ -6,15 +7,16 @@ const WIKI_URL = 'https://github.com/koalyptus/TableFilter/wiki/' +
'4.-Filter-operators';
const WEBSITE_URL = 'http://koalyptus.github.io/TableFilter/';
export class Help{
export class Help extends Feature{
/**
* Help UI component
* @param {Object} tf TableFilter instance
*/
constructor(tf){
// Configuration object
var f = tf.config();
super(tf, 'help');
var f = this.config;
//id of custom container element for instructions
this.tgtId = f.help_instructions_target_id || null;
@ -57,19 +59,17 @@ export class Help{
this.prfxHelpSpan = 'helpSpan_';
//id prefix for help elements
this.prfxHelpDiv = 'helpDiv_';
this.tf = tf;
}
init(){
if(this.btn){
if(this.initialized){
return;
}
var tf = this.tf;
var helpspan = Dom.create('span',['id', this.prfxHelpSpan+tf.id]);
var helpdiv = Dom.create('div',['id', this.prfxHelpDiv+tf.id]);
var helpspan = Dom.create('span', ['id', this.prfxHelpSpan+tf.id]);
var helpdiv = Dom.create('div', ['id', this.prfxHelpDiv+tf.id]);
//help button is added to defined element
if(!this.tgtId){
@ -113,13 +113,16 @@ export class Help{
this.cont = helpdiv;
this.btn = helpspan;
this.initialized = true;
}
/**
* Toggle help pop-up
*/
toggle(){
if(!this.cont){
// check only if explicitily set to false as in this case undefined
// signifies the help feature is enabled by default
if(this.enabled === false){
return;
}
var divDisplay = this.cont.style.display;
@ -134,7 +137,7 @@ export class Help{
* Remove help UI
*/
destroy(){
if(!this.btn){
if(!this.initialized){
return;
}
this.btn.parentNode.removeChild(this.btn);
@ -144,6 +147,9 @@ export class Help{
}
this.cont.parentNode.removeChild(this.cont);
this.cont = null;
this.disable();
this.initialized = false;
}
}

View file

@ -1,18 +1,21 @@
import {Feature} from './feature';
import Dom from '../dom';
import Types from '../types';
var global = window;
export class Loader{
export class Loader extends Feature{
/**
* Loading message/spinner
* @param {Object} tf TableFilter instance
*/
constructor(tf){
super(tf, 'loader');
// TableFilter configuration
var f = tf.config();
var f = this.config;
//id of container element
this.loaderTgtId = f.loader_target_id || null;
//div containing loader
@ -33,8 +36,14 @@ export class Loader{
f.on_hide_loader : null;
//loader div
this.prfxLoader = 'load_';
}
this.tf = tf;
init() {
if(this.initialized){
return;
}
var tf = this.tf;
var containerDiv = Dom.create('div', ['id', this.prfxLoader+tf.id]);
containerDiv.className = this.loaderCssClass;
@ -46,17 +55,19 @@ export class Loader{
} else {
targetEl.appendChild(containerDiv);
}
this.loaderDiv = Dom.id(this.prfxLoader+tf.id);
this.loaderDiv = containerDiv;
if(!this.loaderHtml){
this.loaderDiv.appendChild(Dom.text(this.loaderText));
} else {
this.loaderDiv.innerHTML = this.loaderHtml;
}
this.show('none');
this.initialized = true;
}
show(p) {
if(!this.tf.loader || !this.loaderDiv ||
this.loaderDiv.style.display===p){
if(!this.isEnabled() || this.loaderDiv.style.display === p){
return;
}
@ -64,29 +75,28 @@ export class Loader{
if(!this.loaderDiv){
return;
}
if(this.onShowLoader && p!=='none'){
if(this.onShowLoader && p !== 'none'){
this.onShowLoader.call(null, this);
}
this.loaderDiv.style.display = p;
if(this.onHideLoader && p==='none'){
if(this.onHideLoader && p === 'none'){
this.onHideLoader.call(null, this);
}
};
var t = p==='none' ? this.loaderCloseDelay : 1;
var t = p === 'none' ? this.loaderCloseDelay : 1;
global.setTimeout(displayLoader, t);
}
destroy(){
if(!this.loaderDiv){
if(!this.initialized){
return;
}
var tf = this.tf,
targetEl = !this.loaderTgtId ?
(tf.gridLayout ?
tf.feature('gridLayout').tblCont : tf.tbl.parentNode):
Dom.id(this.loaderTgtId);
targetEl.removeChild(this.loaderDiv);
this.loaderDiv.parentNode.removeChild(this.loaderDiv);
this.loaderDiv = null;
this.disable();
this.initialized = false;
}
}

View file

@ -1,17 +1,20 @@
import {Feature} from './feature';
import Dom from '../dom';
import Types from '../types';
import Str from '../string';
import Event from '../event';
export class Paging{
export class Paging extends Feature{
/**
* Pagination component
* @param {Object} tf TableFilter instance
*/
constructor(tf){
super(tf, 'paging');
// Configuration object
var f = tf.config();
var f = this.config;
//css class for paging buttons (previous,next,etc.)
this.btnPageCssClass = f.paging_btn_css_class || 'pgInp';
@ -170,8 +173,6 @@ export class Paging{
lastEvt: null,
firstEvt: null
};
this.tf = tf;
}
/**
@ -182,6 +183,10 @@ export class Paging{
var tf = this.tf;
var evt = this.evt;
if(this.initialized){
return;
}
// Check resultsPerPage is in expected format and initialise the
// results per page component
if(this.hasResultsPerPage){
@ -321,7 +326,7 @@ export class Paging{
targetEl.appendChild(btnLastSpan);
this.pagingSlc = Dom.id(this.prfxSlcPages+tf.id);
if(!tf.rememberGridValues || this.isPagingRemoved){
if(!tf.rememberGridValues){
this.setPagingInfo();
}
if(!tf.fltGrid){
@ -329,7 +334,7 @@ export class Paging{
this.setPagingInfo(tf.validRowsIndex);
}
this.isPagingRemoved = false;
this.initialized = true;
}
/**
@ -338,11 +343,10 @@ export class Paging{
*/
reset(filterTable=false){
var tf = this.tf;
if(!tf.hasGrid() || tf.paging){
if(!tf.hasGrid() || this.isEnabled()){
return;
}
tf.paging = true;
this.isPagingRemoved = true;
this.enable();
this.init();
tf.resetValues();
if(filterTable){
@ -433,12 +437,12 @@ export class Paging{
if(Types.isNull(isRowValid) || Boolean(isRowValid==='true')){
r.style.display = '';
}
if(tf.alternateBgs && alternateRows){
if(tf.alternateRows && alternateRows){
alternateRows.setRowBg(validRowIdx, h);
}
} else {
r.style.display = 'none';
if(tf.alternateBgs && alternateRows){
if(tf.alternateRows && alternateRows){
alternateRows.removeRowBg(validRowIdx);
}
}
@ -464,7 +468,7 @@ export class Paging{
*/
setPage(cmd){
var tf = this.tf;
if(!tf.hasGrid() || !tf.paging){
if(!tf.hasGrid() || !this.isEnabled()){
return;
}
var btnEvt = this.evt,
@ -530,9 +534,9 @@ export class Paging{
slcRSpan.appendChild(Dom.text(slcRText));
var help = tf.feature('help');
if(help && help.cont){
help.cont.parentNode.insertBefore(slcRSpan, help.cont);
help.cont.parentNode.insertBefore(slcR, help.cont);
if(help && help.btn){
help.btn.parentNode.insertBefore(slcRSpan, help.btn);
help.btn.parentNode.insertBefore(slcR, help.btn);
} else {
targetEl.appendChild(slcRSpan);
targetEl.appendChild(slcR);
@ -609,7 +613,7 @@ export class Paging{
_changePage(index){
var tf = this.tf;
if(!tf.paging){
if(!this.isEnabled()){
return;
}
if(index === null){
@ -648,7 +652,7 @@ export class Paging{
_changeResultsPerPage(){
var tf = this.tf;
if(!tf.paging){
if(!this.isEnabled()){
return;
}
var slcR = this.resultsPerPageSlc;
@ -692,7 +696,7 @@ export class Paging{
*/
_resetPageLength(name){
var tf = this.tf;
if(!tf.paging){
if(!this.isEnabled()){
return;
}
var pglenIndex = tf.feature('store').getPageLength(name);
@ -709,7 +713,7 @@ export class Paging{
destroy(){
var tf = this.tf;
if(!tf.hasGrid()){
if(!this.initialized){
return;
}
// btns containers
@ -774,7 +778,7 @@ export class Paging{
this.pagingSlc = null;
this.nbPages = 0;
this.isPagingRemoved = true;
tf.paging = false;
this.disable();
this.initialized = false;
}
}

View file

@ -1,16 +1,19 @@
import {Feature} from './feature';
import Types from '../types';
import Dom from '../dom';
import Event from '../event';
export class PopupFilter{
export class PopupFilter extends Feature{
/**
* Pop-up filter component
* @param {Object} tf TableFilter instance
*/
constructor(tf){
super(tf, 'popupFilters');
// Configuration object
var f = tf.config();
var f = this.config;
// Enable external filters behaviour
tf.isExternalFlt = true;
@ -52,8 +55,6 @@ export class PopupFilter{
this.prfxPopUpSpan = 'popUpSpan_';
//id prefix for pop-up div containing filter
this.prfxPopUpDiv = 'popUpDiv_';
this.tf = tf;
}
onClick(e){
@ -78,6 +79,10 @@ export class PopupFilter{
* Initialize DOM elements
*/
init(){
if(this.initialized){
return;
}
var tf = this.tf;
for(var i=0; i<tf.nbCells; i++){
if(tf.getFilterType(i) === tf.fltTypeNone){
@ -95,6 +100,17 @@ export class PopupFilter{
this.popUpFltSpans[i] = popUpSpan;
this.popUpFltImgs[i] = popUpSpan.firstChild;
}
this.initialized = true;
}
/**
* Reset previously destroyed feature
*/
reset(){
this.enable();
this.init();
this.buildAll();
}
/**
@ -203,6 +219,10 @@ export class PopupFilter{
* Remove pop-up filters
*/
destroy(){
if(!this.initialized){
return;
}
this.popUpFltElmCache = [];
for(var i=0; i<this.popUpFltElms.length; i++){
var popUpFltElm = this.popUpFltElms[i],
@ -225,6 +245,9 @@ export class PopupFilter{
this.popUpFltElms = [];
this.popUpFltSpans = [];
this.popUpFltImgs = [];
this.disable();
this.initialized = false;
}
}

View file

@ -1,15 +1,18 @@
import {Feature} from './feature';
import Dom from '../dom';
import Types from '../types';
export class RowsCounter{
export class RowsCounter extends Feature{
/**
* Rows counter
* @param {Object} tf TableFilter instance
*/
constructor(tf){
super(tf, 'rowsCounter');
// TableFilter configuration
var f = tf.config();
var f = this.config;
//id of custom container element
this.rowsCounterTgtId = f.rows_counter_target_id || null;
@ -35,17 +38,15 @@ export class RowsCounter{
//callback raised after counter is refreshed
this.onAfterRefreshCounter = Types.isFn(f.on_after_refresh_counter) ?
f.on_after_refresh_counter : null;
this.tf = tf;
}
init(){
var tf = this.tf;
if((!tf.hasGrid() && !tf.isFirstLoad) || this.rowsCounterSpan){
if(this.initialized){
return;
}
var tf = this.tf;
//rows counter container
var countDiv = Dom.create('div', ['id', this.prfxCounter+tf.id]);
countDiv.className = this.totRowsCssClass;
@ -75,6 +76,7 @@ export class RowsCounter{
this.rowsCounterDiv = countDiv;
this.rowsCounterSpan = countSpan;
this.initialized = true;
this.refresh();
}
@ -119,8 +121,7 @@ export class RowsCounter{
}
destroy(){
var tf = this.tf;
if(!tf.hasGrid() || !this.rowsCounterSpan){
if(!this.initialized){
return;
}
@ -131,5 +132,8 @@ export class RowsCounter{
}
this.rowsCounterSpan = null;
this.rowsCounterDiv = null;
this.disable();
this.initialized = false;
}
}

View file

@ -1,17 +1,20 @@
import {Feature} from './feature';
import Dom from '../dom';
import Types from '../types';
var global = window;
export class StatusBar{
export class StatusBar extends Feature{
/**
* Status bar UI component
* @param {Object} tf TableFilter instance
*/
constructor(tf){
super(tf, 'statusBar');
// Configuration object
var f = tf.config();
var f = this.config;
//id of custom container element
this.statusBarTgtId = f.status_bar_target_id || null;
@ -41,16 +44,15 @@ export class StatusBar{
this.prfxStatusSpan = 'statusSpan_';
// text preceding status bar label
this.prfxStatusTxt = 'statusText_';
this.tf = tf;
}
init(){
var tf = this.tf;
if(!tf.hasGrid() && !tf.isFirstLoad){
if(this.initialized){
return;
}
var tf = this.tf;
//status bar container
var statusDiv = Dom.create('div', ['id', this.prfxStatus+tf.id]);
statusDiv.className = this.statusBarCssClass;
@ -84,13 +86,14 @@ export class StatusBar{
this.statusBarSpan = statusSpan;
this.statusBarSpanText = statusSpanText;
this.initialized = true;
}
message(t=''){
var tf = this.tf;
if(!tf.statusBar || !this.statusBarSpan){
if(!this.isEnabled()){
return;
}
if(this.onBeforeShowMsg){
this.onBeforeShowMsg.call(null, this.tf, t);
}
@ -105,8 +108,7 @@ export class StatusBar{
}
destroy(){
var tf = this.tf;
if(!tf.hasGrid() || !this.statusBarDiv){
if(!this.initialized){
return;
}
@ -115,6 +117,9 @@ export class StatusBar{
this.statusBarSpan = null;
this.statusBarSpanText = null;
this.statusBarDiv = null;
this.disable();
this.initialized = false;
}
}

View file

@ -160,7 +160,7 @@ export class TableFilter{
//enables/disables icons (paging, reset button)
this.enableIcons = f.enable_icons===false ? false : true;
//enables/disbles rows alternating bg colors
this.alternateBgs = Boolean(f.alternate_rows);
this.alternateRows = Boolean(f.alternate_rows);
//defines widths of columns
this.hasColWidths = Types.isArray(f.col_widths);
this.colWidths = this.hasColWidths ? f.col_widths : null;
@ -230,10 +230,10 @@ export class TableFilter{
//id of toolbar container element
this.toolBarTgtId = f.toolbar_target_id || null;
//enables/disables help div
this.helpInstructions = Types.isUndef(f.help_instructions) ?
this.help = Types.isUndef(f.help_instructions) ?
undefined : Boolean(f.help_instructions);
//popup filters
this.popUpFilters = Boolean(f.popup_filters);
this.popupFilters = Boolean(f.popup_filters);
//active columns color
this.markActiveColumns = Boolean(f.mark_active_columns);
//defines css class for active column header
@ -539,7 +539,7 @@ export class TableFilter{
let elm = Event.target(_ev);
this.activeFilterId = elm.getAttribute('id');
this.activeFlt = Dom.id(this.activeFilterId);
if(this.popUpFilters){
if(this.popupFilters){
Event.cancel(_ev);
Event.stop(_ev);
}
@ -567,7 +567,7 @@ export class TableFilter{
let ct = elm.getAttribute('ct');
this.Mod.dropdown._build(ct);
}
if(this.popUpFilters){
if(this.popupFilters){
Event.cancel(_ev);
Event.stop(_ev);
}
@ -576,7 +576,7 @@ export class TableFilter{
onSlcChange(e) {
if(!this.activeFlt){ return; }
let _ev = e || global.event;
if(this.popUpFilters){ Event.stop(_ev); }
if(this.popupFilters){ Event.stop(_ev); }
if(this.onSlcChange){ this.filter(); }
},
// fill checklist filter on click if required
@ -612,7 +612,7 @@ export class TableFilter{
if(this.gridLayout){
this.refRow = this.startRow===null ? 0 : this.startRow;
}
if(this.popUpFilters &&
if(this.popupFilters &&
((this.filtersRowIndex === 0 && this.headersRow === 1) ||
this.gridLayout)){
this.headersRow = 0;
@ -641,6 +641,7 @@ export class TableFilter{
if(this.loader){
if(!Mod.loader){
Mod.loader = new Loader(this);
Mod.loader.init();
}
}
@ -648,7 +649,7 @@ export class TableFilter{
Mod.highlightKeyword = new HighlightKeyword(this);
}
if(this.popUpFilters){
if(this.popupFilters){
if(!Mod.popupFilter){
Mod.popupFilter = new PopupFilter(this);
}
@ -677,16 +678,16 @@ export class TableFilter{
if(this.headersRow > 1 &&
this.filtersRowIndex <= this.headersRow &&
!this.popUpFilters){
!this.popupFilters){
this.headersRow++;
}
if(this.popUpFilters){
if(this.popupFilters){
this.headersRow++;
}
fltrow.className = this.fltsRowCssClass;
if(this.isExternalFlt || this.popUpFilters){
if(this.isExternalFlt || this.popupFilters){
fltrow.style.display = 'none';
}
}
@ -697,7 +698,7 @@ export class TableFilter{
for(let i=0; i<n; i++){// this loop adds filters
if(this.popUpFilters){
if(this.popupFilters){
Mod.popupFilter.build(i);
}
@ -882,20 +883,15 @@ export class TableFilter{
if(this.paging || Mod.paging){
if(!Mod.paging){
Mod.paging = new Paging(this);
}
// TODO: handle both cases in paging init
if(Mod.paging.isPagingRemoved){
Mod.paging.reset();
} else {
Mod.paging.init();
}
Mod.paging.reset();
}
if(this.btnReset){
Mod.clearButton = new ClearButton(this);
Mod.clearButton.init();
}
if(this.helpInstructions){
if(this.help){
if(!Mod.help){
Mod.help = new Help(this);
}
@ -904,7 +900,7 @@ export class TableFilter{
if(this.hasColWidths && !this.gridLayout){
this.setColWidths();
}
if(this.alternateBgs){
if(this.alternateRows){
Mod.alternateRows = new AlternateRows(this);
Mod.alternateRows.init();
}
@ -1176,7 +1172,9 @@ export class TableFilter{
let rows = this.tbl.rows,
Mod = this.Mod;
if(this.isExternalFlt && !this.popUpFilters){
this._clearFilters();
if(this.isExternalFlt && !this.popupFilters){
this.removeExternalFlts();
}
if(this.infDiv){
@ -1192,16 +1190,12 @@ export class TableFilter{
this.destroyExtensions();
}
//this loop shows all rows and removes validRow attribute
for(let j=this.refRow; j<this.nbRows; j++){
rows[j].style.display = '';
if(rows[j].hasAttribute('validRow')){
rows[j].removeAttribute('validRow');
}
// validate row
this.validateRow(j, true);
//removes alternating colors
if(this.alternateBgs){
if(this.alternateRows){
Mod.alternateRows.removeRowBg(j);
}
@ -1221,8 +1215,9 @@ export class TableFilter{
});
Dom.removeClass(this.tbl, this.prfxTf);
this.nbHiddenRows = 0;
this.validRowsIndex = null;
this.activeFlt = null;
this.isStartBgAlternate = true;
this._hasGrid = false;
this.tbl = null;
}
@ -1278,12 +1273,12 @@ export class TableFilter{
// Enable help instructions by default if topbar is generated and not
// explicitely set to false
if(Types.isUndef(this.helpInstructions)){
if(Types.isUndef(this.help)){
if(!this.Mod.help){
this.Mod.help = new Help(this);
}
this.Mod.help.init();
this.helpInstructions = true;
this.help = true;
}
}
@ -1504,7 +1499,7 @@ export class TableFilter{
Mod.highlightKeyword.unhighlightAll();
}
//removes popup filters active icons
if(this.popUpFilters){
if(this.popupFilters){
Mod.popupFilter.buildIcons();
}
//removes active column header class
@ -1797,7 +1792,7 @@ export class TableFilter{
if(this.singleSearchFlt && occurence[j]){
singleFltRowValid = true;
}
if(this.popUpFilters){
if(this.popupFilters){
Mod.popupFilter.buildIcon(j, true);
}
if(this.markActiveColumns){
@ -1833,7 +1828,7 @@ export class TableFilter{
} else {
this.validateRow(k, true);
this.validRowsIndex.push(k);
if(this.alternateBgs){
if(this.alternateRows){
Mod.alternateRows.setRowBg(k, this.validRowsIndex.length);
}
if(this.onRowValidated){
@ -1891,7 +1886,7 @@ export class TableFilter{
Mod.rowsCounter.refresh(this.nbVisibleRows);
}
if(this.popUpFilters){
if(this.popupFilters){
Mod.popupFilter.closeAll();
}
}
@ -2503,9 +2498,9 @@ export class TableFilter{
this.nbVisibleRows = this.nbFilterableRows;
this.nbRows = rows.length;
if(this.popUpFilters){
if(this.popupFilters){
this.headersRow++;
Mod.popupFilter.buildAll();
Mod.popupFilter.reset();
}
if(!this.gridLayout){

View file

@ -14,6 +14,49 @@ test('AlternateRows component', function() {
deepEqual(altRows.oddCss, 'odd', 'Expected odd css class');
});
module('Feature interface');
test('Properties', function() {
deepEqual(
altRows.tf instanceof TableFilter, true, 'TableFilter instance');
deepEqual(altRows.feature, 'alternateRows', 'Feature name');
deepEqual(altRows.enabled, true, 'Feature enabled');
deepEqual(altRows.initialized, true, 'Feature enabled');
deepEqual(typeof altRows.config, 'object', 'TF configuration object');
deepEqual(typeof altRows.init, 'function', 'Feature init method');
deepEqual(typeof altRows.destroy, 'function', 'Feature destroy method');
deepEqual(typeof altRows.reset, 'function', 'Feature reset method');
deepEqual(typeof altRows.enable, 'function', 'Feature enable method');
deepEqual(typeof altRows.disable, 'function', 'Feature enable method');
deepEqual(
typeof altRows.isEnabled, 'function', 'Feature enable method');
});
test('Can destroy', function() {
altRows.destroy();
deepEqual(altRows.enabled, false, 'disabled');
});
test('Can reset', function() {
altRows.reset();
deepEqual(altRows.enabled, true, 'enabled');
});
test('Can disable', function() {
altRows.disable();
deepEqual(altRows.enabled, false, 'disabled');
});
test('Can enable', function() {
altRows.enable();
deepEqual(altRows.enabled, true, 'enabled');
});
test('Can init', function() {
altRows.destroy();
altRows.enable();
altRows.init();
deepEqual(altRows.enabled, true, 'enabled');
});
test('Can check is enabled', function() {
altRows.isEnabled();
deepEqual(altRows.enabled, true, 'enabled');
});
module('Actions');
test('Filter column', function() {
tf.setFilterValue(2, '>1400');
@ -31,12 +74,6 @@ test('Clear filters', function() {
deepEqual(tbl.querySelectorAll('tr.even').length, 4, 'Even bg removed');
});
test('Remove alternating rows', function() {
altRows.remove();
deepEqual(tbl.querySelectorAll('tr.odd').length, 0, 'Odd bgs removed');
deepEqual(tbl.querySelectorAll('tr.even').length, 0, 'Even bg removed');
});
test('Set background on a row', function() {
altRows.setRowBg(4);
deepEqual(tbl.rows[4].className, 'odd', 'Bg set on expected row');
@ -48,6 +85,12 @@ test('Remove background on a row', function() {
0, 'Bg set on expected row');
});
test('Remove alternating rows', function() {
altRows.destroy();
deepEqual(tbl.querySelectorAll('tr.odd').length, 0, 'Odd bgs removed');
deepEqual(tbl.querySelectorAll('tr.even').length, 0, 'Even bg removed');
});
test('Grid layout: initialising alternating rows', function() {
tf.destroy();
tf = null;
@ -82,12 +125,6 @@ test('Grid layout: clear filters', function() {
deepEqual(tbl.querySelectorAll('tr.even').length, 4, 'Even bg removed');
});
test('Grid layout: remove alternating rows', function() {
altRows.remove();
deepEqual(tbl.querySelectorAll('tr.odd').length, 0, 'Odd bgs removed');
deepEqual(tbl.querySelectorAll('tr.even').length, 0, 'Even bg removed');
});
test('Grid layout: set background on a row', function() {
altRows.setRowBg(4);
deepEqual(tbl.rows[4].className, 'odd', 'Bg set on expected row');
@ -98,3 +135,15 @@ test('Grid layout: remove background on a row', function() {
deepEqual(tbl.rows[4].querySelectorAll('.odd').length,
0, 'Bg set on expected row');
});
test('Grid layout: remove alternating rows', function() {
altRows.destroy();
deepEqual(tbl.querySelectorAll('tr.odd').length, 0, 'Odd bgs removed');
deepEqual(tbl.querySelectorAll('tr.even').length, 0, 'Even bg removed');
});
module('Tear-down');
test('can destroy TableFilter DOM elements', function() {
tf.destroy();
deepEqual(tf.hasGrid(), false, 'Filters removed');
});

View file

@ -7,6 +7,7 @@
module('Sanity checks');
test('TableFilter object', function() {
deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated');
deepEqual(tf.id, 'demo', 'id check');
deepEqual(tf.getFiltersRowIndex(), 0, 'Filters row index');
deepEqual(tf.getHeadersRowIndex(), 1, 'Headers row index');

View file

@ -12,11 +12,58 @@ test('Clear button component', function() {
notEqual(clearButton.btnResetEl, null, 'btnResetEl property');
});
module('Feature interface');
test('Properties', function() {
deepEqual(
clearButton.tf instanceof TableFilter, true, 'TableFilter instance');
deepEqual(clearButton.feature, 'btnReset', 'Feature name');
deepEqual(clearButton.enabled, true, 'Feature enabled');
deepEqual(clearButton.initialized, true, 'Feature enabled');
deepEqual(typeof clearButton.config, 'object', 'TF configuration object');
deepEqual(typeof clearButton.init, 'function', 'Feature init method');
deepEqual(typeof clearButton.destroy, 'function', 'Feature destroy method');
deepEqual(typeof clearButton.reset, 'function', 'Feature reset method');
deepEqual(typeof clearButton.enable, 'function', 'Feature enable method');
deepEqual(typeof clearButton.disable, 'function', 'Feature enable method');
deepEqual(
typeof clearButton.isEnabled, 'function', 'Feature enable method');
});
test('Can destroy', function() {
clearButton.destroy();
deepEqual(clearButton.enabled, false, 'disabled');
});
test('Can reset', function() {
clearButton.reset();
deepEqual(clearButton.enabled, true, 'enabled');
});
test('Can disable', function() {
clearButton.disable();
deepEqual(clearButton.enabled, false, 'disabled');
});
test('Can enable', function() {
clearButton.enable();
deepEqual(clearButton.enabled, true, 'enabled');
});
test('Can init', function() {
clearButton.destroy();
clearButton.enable();
clearButton.init();
deepEqual(clearButton.enabled, true, 'enabled');
});
test('Can check is enabled', function() {
clearButton.isEnabled();
deepEqual(clearButton.enabled, true, 'enabled');
});
module('UI elements');
test('ClearButton UI elements', function() {
var container = clearButton.btnResetEl;
deepEqual(container.nodeName, 'INPUT', 'Clear button container');
deepEqual(container.parentNode.id, clearButton.prfxResetSpan+tf.id, 'Container id');
deepEqual(
container.parentNode.id,
clearButton.prfxResetSpan+tf.id,
'Container id'
);
});
module('Destroy and re-init');
@ -28,12 +75,18 @@ test('Remove UI', function() {
test('Re-set UI', function() {
tf.enableIcons = false;
tf.feature('clearButton').btnResetHtml = null;
tf.feature('clearButton').btnResetText = 'Clear';
tf.feature('clearButton').init();
clearButton = tf.feature('clearButton');
clearButton.btnResetHtml = null;
clearButton.btnResetText = 'Clear';
clearButton.init();
var btnResetEl = tf.feature('clearButton').btnResetEl;
var btnResetEl = clearButton.btnResetEl;
deepEqual(btnResetEl.nodeName, 'A', 'Clear button tag changed');
deepEqual(btnResetEl.innerText, 'Clear', 'Clear button text');
});
module('Tear-down');
test('can destroy TableFilter DOM elements', function() {
tf.destroy();
deepEqual(tf.hasGrid(), false, 'Filters removed');
});

View file

@ -12,6 +12,47 @@ test('Clear button component', function() {
notEqual(help.btn, null, 'btn property');
});
module('Feature interface');
test('Properties', function() {
deepEqual(help.tf instanceof TableFilter, true, 'TableFilter instance');
deepEqual(help.feature, 'help', 'Feature name');
deepEqual(help.enabled, true, 'Feature enabled');
deepEqual(help.initialized, true, 'Feature enabled');
deepEqual(typeof help.config, 'object', 'TF configuration object');
deepEqual(typeof help.init, 'function', 'Feature init method');
deepEqual(typeof help.destroy, 'function', 'Feature destroy method');
deepEqual(typeof help.reset, 'function', 'Feature reset method');
deepEqual(typeof help.enable, 'function', 'Feature enable method');
deepEqual(typeof help.disable, 'function', 'Feature enable method');
deepEqual(typeof help.isEnabled, 'function', 'Feature enable method');
});
test('Can destroy', function() {
help.destroy();
deepEqual(help.enabled, false, 'disabled');
});
test('Can reset', function() {
help.reset();
deepEqual(help.enabled, true, 'enabled');
});
test('Can disable', function() {
help.disable();
deepEqual(help.enabled, false, 'disabled');
});
test('Can enable', function() {
help.enable();
deepEqual(help.enabled, true, 'enabled');
});
test('Can init', function() {
help.destroy();
help.enable();
help.init();
deepEqual(help.enabled, true, 'enabled');
});
test('Can check is enabled', function() {
help.isEnabled();
deepEqual(help.enabled, true, 'enabled');
});
module('UI elements');
test('Help UI elements', function() {
var container = help.cont,
@ -45,3 +86,9 @@ test('Re-set UI', function() {
);
notEqual(helpBtn.innerHTML.indexOf('→Help←'), -1, 'Help button text');
});
module('Tear-down');
test('can destroy TableFilter DOM elements', function() {
tf.destroy();
deepEqual(tf.hasGrid(), false, 'Filters removed');
});

View file

@ -9,16 +9,29 @@ var highlightKeyword = tf.feature('highlightKeyword');
module('Sanity checks');
test('HighlightKeyword component', function() {
deepEqual(typeof highlightKeyword, 'object', 'Instanciated');
deepEqual(highlightKeyword.highlightedNodes instanceof Array, true, 'Property check');
deepEqual(highlightKeyword.highlightedNodes instanceof Array,
true, 'Property check');
});
test('Highlighted keywords', function() {
tf.setFilterValue(1, 'Perth');
tf.setFilterValue(3, '3.1');
tf._filter();
deepEqual(highlightKeyword.highlightedNodes.length, 2, 'Number of highlighted words');
deepEqual(highlightKeyword.highlightedNodes.length,
2, 'Number of highlighted words');
tf._clearFilters();
tf._filter();
deepEqual(highlightKeyword.highlightedNodes.length, 0, 'Number of highlighted words');
deepEqual(highlightKeyword.highlightedNodes.length,
0, 'Number of highlighted words');
});
module('Tear-down');
test('can destroy TableFilter DOM elements', function() {
tf.setFilterValue(1, 'Perth');
tf._filter();
tf.destroy();
deepEqual(tf.hasGrid(), false, 'Filters removed');
deepEqual(highlightKeyword.highlightedNodes.length,
0, 'Number of highlighted words');
});

View file

@ -5,9 +5,10 @@ var tf = new TableFilter('demo', {
});
tf.init();
var loader = tf.feature('loader');
module('Sanity checks');
test('Loader component', function() {
var loader = tf.feature('loader');
notEqual(loader, null, 'Loader instanciated');
notEqual(
document.getElementById(loader.prfxLoader+tf.id),
@ -15,3 +16,60 @@ test('Loader component', function() {
'Loader DOM container'
);
});
module('Feature interface');
test('Properties', function() {
deepEqual(loader.tf instanceof TableFilter, true, 'TableFilter instance');
deepEqual(loader.feature, 'loader', 'Feature name');
deepEqual(loader.enabled, true, 'Feature enabled');
deepEqual(loader.initialized, true, 'Feature enabled');
deepEqual(typeof loader.config, 'object', 'TF configuration object');
deepEqual(typeof loader.init, 'function', 'Feature init method');
deepEqual(typeof loader.destroy, 'function', 'Feature destroy method');
deepEqual(typeof loader.reset, 'function', 'Feature reset method');
deepEqual(typeof loader.enable, 'function', 'Feature enable method');
deepEqual(typeof loader.disable, 'function', 'Feature enable method');
deepEqual(typeof loader.isEnabled, 'function', 'Feature enable method');
});
test('Can destroy', function() {
loader.destroy();
deepEqual(loader.enabled, false, 'disabled');
});
test('Can reset', function() {
loader.reset();
deepEqual(loader.enabled, true, 'enabled');
});
test('Can disable', function() {
loader.disable();
deepEqual(loader.enabled, false, 'disabled');
});
test('Can enable', function() {
loader.enable();
deepEqual(loader.enabled, true, 'enabled');
});
test('Can init', function() {
loader.destroy();
loader.enable();
loader.init();
deepEqual(loader.enabled, true, 'enabled');
});
test('Can check is enabled', function() {
loader.isEnabled();
deepEqual(loader.enabled, true, 'enabled');
});
module('Behaviour');
test('Can show loader', function() {
loader.show('');
deepEqual(loader.loaderDiv.style.display, '', 'Loader is displayed');
});
test('Can show loader', function() {
loader.show('');
deepEqual(loader.loaderDiv.style.display, '', 'Loader is displayed');
});
module('Tear-down');
test('can destroy TableFilter DOM elements', function() {
tf.destroy();
deepEqual(tf.hasGrid(), false, 'Filters removed');
});

View file

@ -16,6 +16,48 @@ test('Paging component', function() {
deepEqual(paging.pagingLength, 2, 'Paging length');
deepEqual(paging.nbPages, 4, 'Number of pages');
});
module('Feature interface');
test('Properties', function() {
deepEqual(
paging.tf instanceof TableFilter, true, 'TableFilter instance');
deepEqual(paging.feature, 'paging', 'Feature name');
deepEqual(paging.enabled, true, 'Feature enabled');
deepEqual(paging.initialized, true, 'Feature enabled');
deepEqual(typeof paging.config, 'object', 'TF configuration object');
deepEqual(typeof paging.init, 'function', 'Feature init method');
deepEqual(typeof paging.destroy, 'function', 'Feature destroy method');
deepEqual(typeof paging.reset, 'function', 'Feature reset method');
deepEqual(typeof paging.enable, 'function', 'Feature enable method');
deepEqual(typeof paging.disable, 'function', 'Feature enable method');
deepEqual(
typeof paging.isEnabled, 'function', 'Feature enable method');
});
test('Can destroy', function() {
paging.destroy();
deepEqual(paging.enabled, false, 'disabled');
});
test('Can reset', function() {
paging.reset();
deepEqual(paging.enabled, true, 'enabled');
});
test('Can disable', function() {
paging.disable();
deepEqual(paging.enabled, false, 'disabled');
});
test('Can enable', function() {
paging.enable();
deepEqual(paging.enabled, true, 'enabled');
});
test('Can init', function() {
paging.destroy();
paging.enable();
paging.init();
deepEqual(paging.enabled, true, 'enabled');
});
test('Can check is enabled', function() {
paging.isEnabled();
deepEqual(paging.enabled, true, 'enabled');
});
module('UI elements');
test('Paging UI elements', function() {
@ -165,6 +207,10 @@ test('Set results per page', function() {
paging.changeResultsPerPage();
deepEqual(paging.pagingLength, 6, 'Expected page length');
deepEqual(paging.nbPages, 2, 'Expected number of pages');
tf.destroy();
});
module('Tear-down');
test('can destroy TableFilter DOM elements', function() {
tf.destroy();
deepEqual(tf.hasGrid(), false, 'Filters removed');
});

View file

@ -83,9 +83,30 @@ test('Pop-up filter UI elements with grid-layout', function() {
deepEqual(fltIcn3, undefined, 'Filter icon does not exist for column 4');
});
module('Feature interface');
test('Properties', function() {
var popupFilter = tf.feature('popupFilter');
deepEqual(popupFilter.tf instanceof TableFilter,
true, 'TableFilter instance');
deepEqual(popupFilter.feature, 'popupFilters', 'Feature name');
deepEqual(popupFilter.enabled, true, 'Feature enabled');
deepEqual(popupFilter.initialized, true, 'Feature enabled');
deepEqual(typeof popupFilter.config, 'object', 'TF configuration object');
deepEqual(typeof popupFilter.init, 'function', 'Feature init method');
deepEqual(typeof popupFilter.destroy, 'function', 'Feature destroy method');
deepEqual(typeof popupFilter.reset, 'function', 'Feature reset method');
deepEqual(typeof popupFilter.enable, 'function', 'Feature enable method');
deepEqual(typeof popupFilter.disable, 'function', 'Feature enable method');
deepEqual(typeof popupFilter.isEnabled,
'function', 'Feature enable method');
});
module('Tear-down');
test('TableFilter removed', function() {
tf.destroy();
var fltIcn1 = popupFilter.popUpFltImgs[3];
deepEqual(fltIcn1, undefined, 'Filter icon is removed');
deepEqual(id(tf.fltIds[3]), null, 'Filter is removed');
deepEqual(tf.hasGrid(), false, 'Filters removed');
});

View file

@ -4,14 +4,59 @@ var tf = new TableFilter('demo', {
rows_counter: true
});
tf.init();
var rowsCounter = tf.feature('rowsCounter');
module('Sanity checks');
test('RowsCounter component', function() {
notEqual(tf.feature('rowsCounter'), null, 'RowsCounter instanciated');
notEqual(rowsCounter, null, 'RowsCounter instanciated');
});
test('RowsCounter component', function() {
equal(tf.feature('rowsCounter').rowsCounterSpan.innerHTML,
module('Feature interface');
test('Properties', function() {
deepEqual(
rowsCounter.tf instanceof TableFilter, true, 'TableFilter instance');
deepEqual(rowsCounter.feature, 'rowsCounter', 'Feature name');
deepEqual(rowsCounter.enabled, true, 'Feature enabled');
deepEqual(rowsCounter.initialized, true, 'Feature enabled');
deepEqual(typeof rowsCounter.config, 'object', 'TF configuration object');
deepEqual(typeof rowsCounter.init, 'function', 'Feature init method');
deepEqual(typeof rowsCounter.destroy, 'function', 'Feature destroy method');
deepEqual(typeof rowsCounter.reset, 'function', 'Feature reset method');
deepEqual(typeof rowsCounter.enable, 'function', 'Feature enable method');
deepEqual(typeof rowsCounter.disable, 'function', 'Feature enable method');
deepEqual(
typeof rowsCounter.isEnabled, 'function', 'Feature enable method');
});
test('Can destroy', function() {
rowsCounter.destroy();
deepEqual(rowsCounter.enabled, false, 'disabled');
});
test('Can reset', function() {
rowsCounter.reset();
deepEqual(rowsCounter.enabled, true, 'enabled');
});
test('Can disable', function() {
rowsCounter.disable();
deepEqual(rowsCounter.enabled, false, 'disabled');
});
test('Can enable', function() {
rowsCounter.enable();
deepEqual(rowsCounter.enabled, true, 'enabled');
});
test('Can init', function() {
rowsCounter.destroy();
rowsCounter.enable();
rowsCounter.init();
deepEqual(rowsCounter.enabled, true, 'enabled');
});
test('Can check is enabled', function() {
rowsCounter.isEnabled();
deepEqual(rowsCounter.enabled, true, 'enabled');
});
module('Behaviour');
test('RowsCounter value', function() {
equal(rowsCounter.rowsCounterSpan.innerHTML,
7, 'Counter value');
});
@ -19,13 +64,13 @@ test('RowsCounter component with filtered table', function() {
tf.setFilterValue(0, 'Syd');
tf.filter();
equal(tf.feature('rowsCounter').rowsCounterSpan.innerHTML,
equal(rowsCounter.rowsCounterSpan.innerHTML,
4, 'Counter value');
tf.clearFilters();
});
module('With pagination');
module('Pagination');
test('RowsCounter component with paging', function() {
tf.destroy();
tf = null;
@ -38,3 +83,9 @@ test('RowsCounter component with paging', function() {
equal(tf.feature('rowsCounter').rowsCounterSpan.innerHTML,
'1-7 / 7', 'Counter value with paging');
});
module('Tear-down');
test('can destroy TableFilter DOM elements', function() {
tf.destroy();
deepEqual(tf.hasGrid(), false, 'Filters removed');
});

View file

@ -59,6 +59,7 @@ function startPaging(tf, sort){
deepEqual(sort.stt instanceof SortableTable, true, 'Sort type');
deepEqual(sort.sorted, false, 'Table not sorted');
deepEqual(sort.initialized, true, 'Sort initialized');
deepEqual(tf.paging, true, 'Table is paged');
});
module('UI elements');
@ -71,9 +72,7 @@ function startPaging(tf, sort){
test('Sort behaviour', function() {
sort.sortByColumnIndex(0);
deepEqual(sort.sorted, true, 'Table column sorted');
deepEqual(tf.paging, true, 'Table is paged');
});
module('Destroy and re-init');

View file

@ -98,6 +98,7 @@ function startPaging(tf, sort){
deepEqual(sort.stt instanceof SortableTable, true, 'Sort type');
deepEqual(sort.sorted, false, 'Table not sorted');
deepEqual(sort.initialized, true, 'Sort initialized');
deepEqual(tf.paging, true, 'Table is paged');
});
module('UI elements');
@ -112,7 +113,6 @@ function startPaging(tf, sort){
sort.sortByColumnIndex(0);
deepEqual(sort.sorted, true, 'Table column sorted');
deepEqual(tf.paging, true, 'Table is paged');
});
module('Destroy and re-init');

View file

@ -11,6 +11,48 @@ test('Status bar component', function() {
notEqual(statusBar.statusBarDiv, null, 'statusBarDiv property');
});
module('Feature interface');
test('Properties', function() {
deepEqual(statusBar.tf instanceof TableFilter,
true, 'TableFilter instance');
deepEqual(statusBar.feature, 'statusBar', 'Feature name');
deepEqual(statusBar.enabled, true, 'Feature enabled');
deepEqual(statusBar.initialized, true, 'Feature enabled');
deepEqual(typeof statusBar.config, 'object', 'TF configuration object');
deepEqual(typeof statusBar.init, 'function', 'Feature init method');
deepEqual(typeof statusBar.destroy, 'function', 'Feature destroy method');
deepEqual(typeof statusBar.reset, 'function', 'Feature reset method');
deepEqual(typeof statusBar.enable, 'function', 'Feature enable method');
deepEqual(typeof statusBar.disable, 'function', 'Feature enable method');
deepEqual(typeof statusBar.isEnabled, 'function', 'Feature enable method');
});
test('Can destroy', function() {
statusBar.destroy();
deepEqual(statusBar.enabled, false, 'disabled');
});
test('Can reset', function() {
statusBar.reset();
deepEqual(statusBar.enabled, true, 'enabled');
});
test('Can disable', function() {
statusBar.disable();
deepEqual(statusBar.enabled, false, 'disabled');
});
test('Can enable', function() {
statusBar.enable();
deepEqual(statusBar.enabled, true, 'enabled');
});
test('Can init', function() {
statusBar.destroy();
statusBar.enable();
statusBar.init();
deepEqual(statusBar.enabled, true, 'enabled');
});
test('Can check is enabled', function() {
statusBar.isEnabled();
deepEqual(statusBar.enabled, true, 'enabled');
});
module('UI elements');
test('Status bar UI elements', function() {
var container = statusBar.statusBarDiv,
@ -37,3 +79,8 @@ test('Re-set UI', function() {
label.innerHTML.indexOf('→←'), -1, 'Status bar text');
});
module('Tear-down');
test('can destroy TableFilter DOM elements', function() {
tf.destroy();
deepEqual(tf.hasGrid(), false, 'Filters removed');
});

View file

@ -5,10 +5,11 @@
});
tf.init();
module("Table 1: sanity checks");
test("TableFilter object", function() {
equal(tf.id, 'demo', 'id check');
equal(tf.filtersRowIndex, 0, 'Filters row index');
module('Table 1: sanity checks');
test('TableFilter object', function() {
deepEqual(tf instanceof TableFilter, true, 'TableFilter instanciated');
deepEqual(tf.id, 'demo', 'id check');
deepEqual(tf.filtersRowIndex, 0, 'Filters row index');
deepEqual(tf.getCellsNb(), 5, 'filters type collection length');
});