1
0
Fork 0
mirror of https://github.com/koalyptus/TableFilter.git synced 2024-06-03 06:22:34 +02:00

Merge pull request #464 from koalyptus/refactor-paging-options

Refactor paging options
This commit is contained in:
koalyptus 2017-06-15 13:43:50 +10:00 committed by GitHub
commit ab9ff96684
32 changed files with 213 additions and 200 deletions

View file

@ -13,7 +13,7 @@
"keyword-spacing": ["error", { "after": true, "before": true }], "keyword-spacing": ["error", { "after": true, "before": true }],
"max-depth": [2, 7], "max-depth": [2, 7],
"max-statements": [2, 143], "max-statements": [2, 143],
"complexity": [2, 82], "complexity": [2, 83],
"no-unused-vars": 2, "no-unused-vars": 2,
"no-eval": 2, "no-eval": 2,
"no-underscore-dangle": 0, "no-underscore-dangle": 0,

4
dist/starter.html vendored
View file

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

View file

@ -1,6 +1,6 @@
/** /**
* tablefilter v0.5.20 by Max Guglielmi * tablefilter v0.5.21 by Max Guglielmi
* build date: 2017-06-04T08:16:15.416Z * build date: 2017-06-14T12:10:10.152Z
* MIT License * 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} 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.5.20 by Max Guglielmi * tablefilter v0.5.21 by Max Guglielmi
* build date: 2017-06-04T08:16:15.416Z * build date: 2017-06-14T12:10:10.152Z
* MIT License * 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} 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.5.20 by Max Guglielmi * tablefilter v0.5.21 by Max Guglielmi
* build date: 2017-06-04T08:16:15.416Z * build date: 2017-06-14T12:10:10.152Z
* MIT License * MIT License
*/ */
.activeHeader{background-color:#66afe9 !important;color:#fff !important} .activeHeader{background-color:#66afe9 !important;color:#fff !important}

View file

@ -1,6 +1,6 @@
/** /**
* tablefilter v0.5.20 by Max Guglielmi * tablefilter v0.5.21 by Max Guglielmi
* build date: 2017-06-04T08:16:15.416Z * build date: 2017-06-14T12:10:10.152Z
* MIT License * MIT License
*/ */
table.TF{border-left:1px solid #ccc;border-top:none;border-right:none;border-bottom:none;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x;border-bottom:1px solid #d0d0d0;border-right:1px solid #d0d0d0;border-left:1px solid #fff;border-top:1px solid #fff;color:#333}table.TF td{border-bottom:1px dotted #999;padding:5px}.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}.activeHeader{background:#999 !important} table.TF{border-left:1px solid #ccc;border-top:none;border-right:none;border-bottom:none;}table.TF th{background:#ebecee url("images/bg_th.jpg") left top repeat-x;border-bottom:1px solid #d0d0d0;border-right:1px solid #d0d0d0;border-left:1px solid #fff;border-top:1px solid #fff;color:#333}table.TF td{border-bottom:1px dotted #999;padding:5px}.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}.activeHeader{background:#999 !important}

View file

@ -1,6 +1,6 @@
/** /**
* tablefilter v0.5.20 by Max Guglielmi * tablefilter v0.5.21 by Max Guglielmi
* build date: 2017-06-04T08:16:15.416Z * build date: 2017-06-14T12:10:10.152Z
* MIT License * MIT License
*/ */
table.TF{border-left:1px dotted #81963b;border-top:none;border-right:0;border-bottom:none;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x;border-bottom:0;border-right:1px dotted #d0d0d0;border-left:0;border-top:0;color:#fff}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px}.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}.activeHeader{background:#81963b !important} table.TF{border-left:1px dotted #81963b;border-top:none;border-right:0;border-bottom:none;}table.TF th{background:#39424b url("images/bg_headers.jpg") left top repeat-x;border-bottom:0;border-right:1px dotted #d0d0d0;border-left:0;border-top:0;color:#fff}table.TF td{border-bottom:1px dotted #81963b;border-right:1px dotted #81963b;padding:5px}.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}.activeHeader{background:#81963b !important}

View file

@ -1,6 +1,6 @@
/** /**
* tablefilter v0.5.20 by Max Guglielmi * tablefilter v0.5.21 by Max Guglielmi
* build date: 2017-06-04T08:16:15.416Z * build date: 2017-06-14T12:10:10.152Z
* MIT License * 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} 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}

View file

@ -1,6 +1,6 @@
/** /**
* tablefilter v0.5.20 by Max Guglielmi * tablefilter v0.5.21 by Max Guglielmi
* build date: 2017-06-04T08:16:15.416Z * build date: 2017-06-14T12:10:10.152Z
* MIT License * MIT License
*/ */
table.TF{padding:0;color:inherit;border-right:1px solid transparent;border-top:1px solid transparent;border-left:1px solid transparent;border-bottom:0;}table.TF th{margin:0;color:inherit;background-color:transparent;border-color:transparent;border-width:1px;border-style:solid;}table.TF th:last-child{border-right:1px solid transparent}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid transparent;border-left:0;border-top:0;border-right:0}.fltrow{background-color:transparent;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px;border-bottom:1px solid transparent !important;}.fltrow th:last-child,.fltrow td:last-child{border-right:1px solid transparent}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4}input.flt{width:99% !important}.inf{background-color:transparent;border:1px solid transparent;height:$min-height;color:inherit}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:#f7f7f7 url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#f7f7f7 url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#f7f7f7 url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#f7f7f7 url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.activeHeader{background:#f7f7f7 !important;border:1px solid transparent;color:inherit !important}div.grd_Cont{-webkit-box-shadow:0 0 0 0 rgba(50,50,50,0.75);-moz-box-shadow:0 0 0 0 rgba(50,50,50,0.75);box-shadow:0 0 0 0 rgba(50,50,50,0.75);background-color:transparent;border:1px solid transparent;padding:0 !important;}div.grd_Cont .even{background-color:transparent}div.grd_Cont .odd{background-color:#f7f7f7}div.grd_headTblCont{background-color:transparent;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:transparent;border-bottom:1px solid transparent;border-right:1px solid transparent !important;border-left:1px solid transparent;border-top:1px solid transparent}div.grd_tblCont table td{border-bottom:1px solid transparent;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:transparent;color:inherit;border-top:1px solid transparent;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#f7f7f7;border:1px solid #f7f7f7;border-radius:5px;color:#000;text-shadow:none}.even{background-color:transparent}.odd{background-color:#f7f7f7}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ccc !important;color:inherit}.ezSelectedRow{background-color:#ccc !important;color:inherit}.ezActiveCell{background-color:transparent;color:inherit;font-weight:bold}.ezETSelectedCell{background-color:transparent;font-weight:bold;color:inherit} table.TF{padding:0;color:inherit;border-right:1px solid transparent;border-top:1px solid transparent;border-left:1px solid transparent;border-bottom:0;}table.TF th{margin:0;color:inherit;background-color:transparent;border-color:transparent;border-width:1px;border-style:solid;}table.TF th:last-child{border-right:1px solid transparent}table.TF td{margin:0;padding:5px;color:inherit;border-bottom:1px solid transparent;border-left:0;border-top:0;border-right:0}.fltrow{background-color:transparent;}.fltrow th,.fltrow td{padding:1px 3px 1px 3px;border-bottom:1px solid transparent !important;}.fltrow th:last-child,.fltrow td:last-child{border-right:1px solid transparent}.flt,select.flt,select.flt_multi,.flt_s,.single_flt,.div_checklist{border:1px solid #a4bed4}input.flt{width:99% !important}.inf{background-color:transparent;border:1px solid transparent;height:$min-height;color:inherit}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:#f7f7f7 url("images/btn_next_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.previousPage{background:transparent url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.previousPage:hover{background:#f7f7f7 url("images/btn_prev_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.firstPage{background:transparent url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.firstPage:hover{background:#f7f7f7 url("images/btn_first_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.lastPage{background:transparent url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid transparent !important;}.lastPage:hover{background:#f7f7f7 url("images/btn_last_page.gif") center center no-repeat !important;border:1px solid #f7f7f7 !important}.activeHeader{background:#f7f7f7 !important;border:1px solid transparent;color:inherit !important}div.grd_Cont{-webkit-box-shadow:0 0 0 0 rgba(50,50,50,0.75);-moz-box-shadow:0 0 0 0 rgba(50,50,50,0.75);box-shadow:0 0 0 0 rgba(50,50,50,0.75);background-color:transparent;border:1px solid transparent;padding:0 !important;}div.grd_Cont .even{background-color:transparent}div.grd_Cont .odd{background-color:#f7f7f7}div.grd_headTblCont{background-color:transparent;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:transparent;border-bottom:1px solid transparent;border-right:1px solid transparent !important;border-left:1px solid transparent;border-top:1px solid transparent}div.grd_tblCont table td{border-bottom:1px solid transparent;border-right:0 !important;border-left:0 !important;border-top:0 !important}.grd_inf{background-color:transparent;color:inherit;border-top:1px solid transparent;}.grd_inf a{text-decoration:none;font-weight:bold}.loader{background-color:#f7f7f7;border:1px solid #f7f7f7;border-radius:5px;color:#000;text-shadow:none}.even{background-color:transparent}.odd{background-color:#f7f7f7}span.expClpFlt a.btnExpClpFlt:hover{background-color:transparent !important}.ezActiveRow{background-color:#ccc !important;color:inherit}.ezSelectedRow{background-color:#ccc !important;color:inherit}.ezActiveCell{background-color:transparent;color:inherit;font-weight:bold}.ezETSelectedCell{background-color:transparent;font-weight:bold;color:inherit}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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", "name": "tablefilter",
"version": "0.5.20", "version": "0.5.21",
"description": "A Javascript library making HTML tables filterable and a bit more", "description": "A Javascript library making HTML tables filterable and a bit more",
"license": "MIT", "license": "MIT",
"author": { "author": {

View file

@ -208,7 +208,7 @@ export default class AdapterEzEditTable extends Feature {
paging = tf.feature('paging'), paging = tf.feature('paging'),
//pgup/pgdown keys //pgup/pgdown keys
d = keyCode === 34 || keyCode === 33 ? d = keyCode === 34 || keyCode === 33 ?
(paging && paging.pagingLength || et.nbRowsPerPage) : (paging && paging.pageLength || et.nbRowsPerPage) :
1; 1;
//If next row is not valid, next valid filtered row needs to be //If next row is not valid, next valid filtered row needs to be
@ -278,11 +278,11 @@ export default class AdapterEzEditTable extends Feature {
if (tf.feature('paging').nbPages > 1) { if (tf.feature('paging').nbPages > 1) {
let paging = tf.feature('paging'); let paging = tf.feature('paging');
//page length is re-assigned in case it has changed //page length is re-assigned in case it has changed
et.nbRowsPerPage = paging.pagingLength; et.nbRowsPerPage = paging.pageLength;
let validIndexes = tf.validRowsIndex, let validIndexes = tf.validRowsIndex,
validIdxLen = validIndexes.length, validIdxLen = validIndexes.length,
pagingEndRow = parseInt(paging.startPagingRow, 10) + pagingEndRow = parseInt(paging.startPagingRow, 10) +
parseInt(paging.pagingLength, 10); parseInt(paging.pageLength, 10);
let rowIndex = row.rowIndex; let rowIndex = row.rowIndex;
if ((rowIndex === validIndexes[validIdxLen - 1]) && if ((rowIndex === validIndexes[validIdxLen - 1]) &&

View file

@ -20,55 +20,55 @@ export class Paging extends Feature {
super(tf, 'paging'); super(tf, 'paging');
// Configuration object // Configuration object
var f = this.config; let f = this.config.paging || {};
/** /**
* Css class for the paging buttons (previous, next, etc.) * Css class for the paging buttons (previous, next, etc.)
* @type {String} * @type {String}
*/ */
this.btnPageCssClass = f.paging_btn_css_class || 'pgInp'; this.btnCssClass = f.btn_css_class || 'pgInp';
/** /**
* Main select DOM element * Main select DOM element
* @type {DOMElement} * @type {DOMElement}
*/ */
this.pagingSlc = null; this.pageSlc = null;
/** /**
* Results per page select DOM element * Results per page select DOM element
* @type {DOMElement} * @type {DOMElement}
*/ */
this.resultsPerPageSlc = null; this.pageLengthSlc = null;
/** /**
* ID of custom container element * ID of custom container element
* @type {String} * @type {String}
*/ */
this.pagingTgtId = f.paging_target_id || null; this.tgtId = f.target_id || null;
/** /**
* Number of rows contained in a page * Number of rows contained in a page
* @type {Number} * @type {Number}
*/ */
this.pagingLength = !isNaN(f.paging_length) ? f.paging_length : 10; this.pageLength = !isNaN(f.length) ? f.length : 10;
/** /**
* ID of custom container element for the results per page selector * ID of custom container element for the results per page selector
* @type {String} * @type {String}
*/ */
this.resultsPerPageTgtId = f.results_per_page_target_id || null; this.pageLengthTgtId = f.results_per_page_target_id || null;
/** /**
* Css class for the paging select element * Css class for the paging select element
* @type {String} * @type {String}
*/ */
this.pgSlcCssClass = f.paging_slc_css_class || 'pgSlc'; this.pgSlcCssClass = f.slc_css_class || 'pgSlc';
/** /**
* Css class for the paging input element * Css class for the paging input element
* @type {String} * @type {String}
*/ */
this.pgInpCssClass = f.paging_inp_css_class || 'pgNbInp'; this.pgInpCssClass = f.inp_css_class || 'pgNbInp';
/** /**
* Label and values for the results per page select, example of usage: * Label and values for the results per page select, example of usage:
@ -146,7 +146,7 @@ export class Paging extends Feature {
*/ */
this.btnNextPageHtml = f.btn_next_page_html || this.btnNextPageHtml = f.btn_next_page_html ||
(!tf.enableIcons ? null : (!tf.enableIcons ? null :
'<input type="button" value="" class="' + this.btnPageCssClass + '<input type="button" value="" class="' + this.btnCssClass +
' nextPage" title="Next page" />'); ' nextPage" title="Next page" />');
/** /**
@ -155,7 +155,7 @@ export class Paging extends Feature {
*/ */
this.btnPrevPageHtml = f.btn_prev_page_html || this.btnPrevPageHtml = f.btn_prev_page_html ||
(!tf.enableIcons ? null : (!tf.enableIcons ? null :
'<input type="button" value="" class="' + this.btnPageCssClass + '<input type="button" value="" class="' + this.btnCssClass +
' previousPage" title="Previous page" />'); ' previousPage" title="Previous page" />');
/** /**
@ -164,7 +164,7 @@ export class Paging extends Feature {
*/ */
this.btnFirstPageHtml = f.btn_first_page_html || this.btnFirstPageHtml = f.btn_first_page_html ||
(!tf.enableIcons ? null : (!tf.enableIcons ? null :
'<input type="button" value="" class="' + this.btnPageCssClass + '<input type="button" value="" class="' + this.btnCssClass +
' firstPage" title="First page" />'); ' firstPage" title="First page" />');
/** /**
@ -173,7 +173,7 @@ export class Paging extends Feature {
*/ */
this.btnLastPageHtml = f.btn_last_page_html || this.btnLastPageHtml = f.btn_last_page_html ||
(!tf.enableIcons ? null : (!tf.enableIcons ? null :
'<input type="button" value="" class="' + this.btnPageCssClass + '<input type="button" value="" class="' + this.btnCssClass +
' lastPage" title="Last page" />'); ' lastPage" title="Last page" />');
/** /**
@ -198,7 +198,7 @@ export class Paging extends Feature {
* Determines if paging buttons are enabled (default: true) * Determines if paging buttons are enabled (default: true)
* @type {Boolean} * @type {Boolean}
*/ */
this.hasPagingBtns = f.paging_btns === false ? false : true; this.hasBtns = f.btns === false ? false : true;
/** /**
* Defines page selector type, two possible values: 'select', 'input' * Defines page selector type, two possible values: 'select', 'input'
@ -269,12 +269,12 @@ export class Paging extends Feature {
*/ */
this.pgAfter = null; this.pgAfter = null;
var start_row = tf.refRow; let startRow = tf.refRow;
var nrows = tf.getRowsNb(true); let nrows = tf.getRowsNb(true);
//calculates page nb //calculates page nb
this.nbPages = Math.ceil((nrows - start_row) / this.pagingLength); this.nbPages = Math.ceil((nrows - startRow) / this.pageLength);
var o = this; let o = this;
/** /**
* Paging DOM events handlers * Paging DOM events handlers
* @type {String} * @type {String}
@ -283,21 +283,21 @@ export class Paging extends Feature {
this.evt = { this.evt = {
slcIndex() { slcIndex() {
return (o.pageSelectorType === SELECT) ? return (o.pageSelectorType === SELECT) ?
o.pagingSlc.options.selectedIndex : o.pageSlc.options.selectedIndex :
parseInt(o.pagingSlc.value, 10) - 1; parseInt(o.pageSlc.value, 10) - 1;
}, },
nbOpts() { nbOpts() {
return (o.pageSelectorType === SELECT) ? return (o.pageSelectorType === SELECT) ?
parseInt(o.pagingSlc.options.length, 10) - 1 : parseInt(o.pageSlc.options.length, 10) - 1 :
(o.nbPages - 1); (o.nbPages - 1);
}, },
next() { next() {
var nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ? let nextIndex = o.evt.slcIndex() < o.evt.nbOpts() ?
o.evt.slcIndex() + 1 : 0; o.evt.slcIndex() + 1 : 0;
o.changePage(nextIndex); o.changePage(nextIndex);
}, },
prev() { prev() {
var prevIndex = o.evt.slcIndex() > 0 ? let prevIndex = o.evt.slcIndex() > 0 ?
o.evt.slcIndex() - 1 : o.evt.nbOpts(); o.evt.slcIndex() - 1 : o.evt.nbOpts();
o.changePage(prevIndex); o.changePage(prevIndex);
}, },
@ -308,7 +308,7 @@ export class Paging extends Feature {
o.changePage(0); o.changePage(0);
}, },
_detectKey(e) { _detectKey(e) {
var key = keyCode(e); let key = keyCode(e);
if (key === ENTER_KEY) { if (key === ENTER_KEY) {
if (tf.sorted) { if (tf.sorted) {
tf.filter(); tf.filter();
@ -331,9 +331,9 @@ export class Paging extends Feature {
* Initialize DOM elements * Initialize DOM elements
*/ */
init() { init() {
var slcPages; let slcPages;
var tf = this.tf; let tf = this.tf;
var evt = this.evt; let evt = this.evt;
if (this.initialized) { if (this.initialized) {
return; return;
@ -345,13 +345,13 @@ export class Paging extends Feature {
if (this.resultsPerPage.length < 2) { if (this.resultsPerPage.length < 2) {
this.hasResultsPerPage = false; this.hasResultsPerPage = false;
} else { } else {
this.pagingLength = this.resultsPerPage[1][0]; this.pageLength = this.resultsPerPage[1][0];
this.setResultsPerPage(); this.setResultsPerPage();
} }
} }
evt.slcPagesChange = (event) => { evt.slcPagesChange = (event) => {
var slc = event.target; let slc = event.target;
this.changePage(slc.selectedIndex); this.changePage(slc.selectedIndex);
}; };
@ -370,20 +370,20 @@ export class Paging extends Feature {
} }
// btns containers // btns containers
var btnNextSpan = createElm('span'); let btnNextSpan = createElm('span');
var btnPrevSpan = createElm('span'); let btnPrevSpan = createElm('span');
var btnLastSpan = createElm('span'); let btnLastSpan = createElm('span');
var btnFirstSpan = createElm('span'); let btnFirstSpan = createElm('span');
if (this.hasPagingBtns) { if (this.hasBtns) {
// Next button // Next button
if (!this.btnNextPageHtml) { if (!this.btnNextPageHtml) {
var btnNext = createElm(INPUT, let btnNext = createElm(INPUT,
['type', 'button'], ['type', 'button'],
['value', this.btnNextPageText], ['value', this.btnNextPageText],
['title', 'Next'] ['title', 'Next']
); );
btnNext.className = this.btnPageCssClass; btnNext.className = this.btnCssClass;
addEvt(btnNext, 'click', evt.next); addEvt(btnNext, 'click', evt.next);
btnNextSpan.appendChild(btnNext); btnNextSpan.appendChild(btnNext);
} else { } else {
@ -392,12 +392,12 @@ export class Paging extends Feature {
} }
// Previous button // Previous button
if (!this.btnPrevPageHtml) { if (!this.btnPrevPageHtml) {
var btnPrev = createElm(INPUT, let btnPrev = createElm(INPUT,
['type', 'button'], ['type', 'button'],
['value', this.btnPrevPageText], ['value', this.btnPrevPageText],
['title', 'Previous'] ['title', 'Previous']
); );
btnPrev.className = this.btnPageCssClass; btnPrev.className = this.btnCssClass;
addEvt(btnPrev, 'click', evt.prev); addEvt(btnPrev, 'click', evt.prev);
btnPrevSpan.appendChild(btnPrev); btnPrevSpan.appendChild(btnPrev);
} else { } else {
@ -406,12 +406,12 @@ export class Paging extends Feature {
} }
// Last button // Last button
if (!this.btnLastPageHtml) { if (!this.btnLastPageHtml) {
var btnLast = createElm(INPUT, let btnLast = createElm(INPUT,
['type', 'button'], ['type', 'button'],
['value', this.btnLastPageText], ['value', this.btnLastPageText],
['title', 'Last'] ['title', 'Last']
); );
btnLast.className = this.btnPageCssClass; btnLast.className = this.btnCssClass;
addEvt(btnLast, 'click', evt.last); addEvt(btnLast, 'click', evt.last);
btnLastSpan.appendChild(btnLast); btnLastSpan.appendChild(btnLast);
} else { } else {
@ -420,12 +420,12 @@ export class Paging extends Feature {
} }
// First button // First button
if (!this.btnFirstPageHtml) { if (!this.btnFirstPageHtml) {
var btnFirst = createElm(INPUT, let btnFirst = createElm(INPUT,
['type', 'button'], ['type', 'button'],
['value', this.btnFirstPageText], ['value', this.btnFirstPageText],
['title', 'First'] ['title', 'First']
); );
btnFirst.className = this.btnPageCssClass; btnFirst.className = this.btnCssClass;
addEvt(btnFirst, 'click', evt.first); addEvt(btnFirst, 'click', evt.first);
btnFirstSpan.appendChild(btnFirst); btnFirstSpan.appendChild(btnFirst);
} else { } else {
@ -435,23 +435,23 @@ export class Paging extends Feature {
} }
// paging elements (buttons+drop-down list) are added to defined element // paging elements (buttons+drop-down list) are added to defined element
if (!this.pagingTgtId) { if (!this.tgtId) {
tf.setToolbar(); tf.setToolbar();
} }
var targetEl = !this.pagingTgtId ? tf.mDiv : elm(this.pagingTgtId); let targetEl = !this.tgtId ? tf.mDiv : elm(this.tgtId);
targetEl.appendChild(btnFirstSpan); targetEl.appendChild(btnFirstSpan);
targetEl.appendChild(btnPrevSpan); targetEl.appendChild(btnPrevSpan);
var pgBeforeSpan = createElm('span'); let pgBeforeSpan = createElm('span');
pgBeforeSpan.appendChild(createText(this.pageText)); pgBeforeSpan.appendChild(createText(this.pageText));
pgBeforeSpan.className = this.nbPgSpanCssClass; pgBeforeSpan.className = this.nbPgSpanCssClass;
targetEl.appendChild(pgBeforeSpan); targetEl.appendChild(pgBeforeSpan);
targetEl.appendChild(slcPages); targetEl.appendChild(slcPages);
var pgAfterSpan = createElm('span'); let pgAfterSpan = createElm('span');
pgAfterSpan.appendChild(createText(this.ofText)); pgAfterSpan.appendChild(createText(this.ofText));
pgAfterSpan.className = this.nbPgSpanCssClass; pgAfterSpan.className = this.nbPgSpanCssClass;
targetEl.appendChild(pgAfterSpan); targetEl.appendChild(pgAfterSpan);
var pgSpan = createElm('span'); let pgSpan = createElm('span');
pgSpan.className = this.nbPgSpanCssClass; pgSpan.className = this.nbPgSpanCssClass;
pgSpan.appendChild(createText(' ' + this.nbPages + ' ')); pgSpan.appendChild(createText(' ' + this.nbPages + ' '));
targetEl.appendChild(pgSpan); targetEl.appendChild(pgSpan);
@ -465,7 +465,7 @@ export class Paging extends Feature {
this.pgCont = pgSpan; this.pgCont = pgSpan;
this.pgBefore = pgBeforeSpan; this.pgBefore = pgBeforeSpan;
this.pgAfter = pgAfterSpan; this.pgAfter = pgAfterSpan;
this.pagingSlc = slcPages; this.pageSlc = slcPages;
this.setPagingInfo(); this.setPagingInfo();
@ -512,31 +512,31 @@ export class Paging extends Feature {
* @param {Array} validRows Collection of valid rows * @param {Array} validRows Collection of valid rows
*/ */
setPagingInfo(validRows) { setPagingInfo(validRows) {
var tf = this.tf; let tf = this.tf;
var mdiv = !this.pagingTgtId ? tf.mDiv : elm(this.pagingTgtId); let mdiv = !this.tgtId ? tf.mDiv : elm(this.tgtId);
//store valid rows indexes //store valid rows indexes
tf.validRowsIndex = validRows || tf.getValidRows(true); tf.validRowsIndex = validRows || tf.getValidRows(true);
//calculate nb of pages //calculate nb of pages
this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pagingLength); this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pageLength);
//refresh page nb span //refresh page nb span
this.pgCont.innerHTML = this.nbPages; this.pgCont.innerHTML = this.nbPages;
//select clearing shortcut //select clearing shortcut
if (this.pageSelectorType === SELECT) { if (this.pageSelectorType === SELECT) {
this.pagingSlc.innerHTML = ''; this.pageSlc.innerHTML = '';
} }
if (this.nbPages > 0) { if (this.nbPages > 0) {
mdiv.style.visibility = 'visible'; mdiv.style.visibility = 'visible';
if (this.pageSelectorType === SELECT) { if (this.pageSelectorType === SELECT) {
for (var z = 0; z < this.nbPages; z++) { for (let z = 0; z < this.nbPages; z++) {
var opt = createOpt(z + 1, z * this.pagingLength, false); let opt = createOpt(z + 1, z * this.pageLength, false);
this.pagingSlc.options[z] = opt; this.pageSlc.options[z] = opt;
} }
} else { } else {
//input type //input type
this.pagingSlc.value = this.currentPageNb; this.pageSlc.value = this.currentPageNb;
} }
} else { } else {
@ -551,10 +551,10 @@ export class Paging extends Feature {
* @param {Array} validRows Collection of valid rows * @param {Array} validRows Collection of valid rows
*/ */
groupByPage(validRows) { groupByPage(validRows) {
var tf = this.tf; let tf = this.tf;
var rows = tf.dom().rows; let rows = tf.dom().rows;
var startPagingRow = parseInt(this.startPagingRow, 10); let startPagingRow = parseInt(this.startPagingRow, 10);
var endPagingRow = startPagingRow + parseInt(this.pagingLength, 10); let endPagingRow = startPagingRow + parseInt(this.pageLength, 10);
//store valid rows indexes //store valid rows indexes
if (validRows) { if (validRows) {
@ -562,11 +562,11 @@ export class Paging extends Feature {
} }
//this loop shows valid rows of current page //this loop shows valid rows of current page
for (var h = 0, len = tf.getValidRowsNb(true); h < len; h++) { for (let h = 0, len = tf.getValidRowsNb(true); h < len; h++) {
var validRowIdx = tf.validRowsIndex[h]; let validRowIdx = tf.validRowsIndex[h];
var r = rows[validRowIdx]; let r = rows[validRowIdx];
var isRowValid = r.getAttribute('validRow'); let isRowValid = r.getAttribute('validRow');
var rowDisplayed = false; let rowDisplayed = false;
if (h >= startPagingRow && h < endPagingRow) { if (h >= startPagingRow && h < endPagingRow) {
if (isNull(isRowValid) || Boolean(isRowValid === 'true')) { if (isNull(isRowValid) || Boolean(isRowValid === 'true')) {
@ -597,11 +597,11 @@ export class Paging extends Feature {
* 'previous', 'last', 'first' or page number as per param * 'previous', 'last', 'first' or page number as per param
*/ */
setPage(cmd) { setPage(cmd) {
var tf = this.tf; let tf = this.tf;
if (!tf.isInitialized() || !this.isEnabled()) { if (!tf.isInitialized() || !this.isEnabled()) {
return; return;
} }
var btnEvt = this.evt, let btnEvt = this.evt,
cmdtype = typeof cmd; cmdtype = typeof cmd;
if (cmdtype === 'string') { if (cmdtype === 'string') {
switch (cmd.toLowerCase()) { switch (cmd.toLowerCase()) {
@ -631,10 +631,10 @@ export class Paging extends Feature {
* Generates UI elements for the number of results per page drop-down * Generates UI elements for the number of results per page drop-down
*/ */
setResultsPerPage() { setResultsPerPage() {
var tf = this.tf; let tf = this.tf;
var evt = this.evt; let evt = this.evt;
if (this.resultsPerPageSlc || !this.resultsPerPage) { if (this.pageLengthSlc || !this.resultsPerPage) {
return; return;
} }
@ -643,22 +643,22 @@ export class Paging extends Feature {
ev.target.blur(); ev.target.blur();
}; };
var slcR = createElm(SELECT); let slcR = createElm(SELECT);
slcR.className = this.resultsSlcCssClass; slcR.className = this.resultsSlcCssClass;
var slcRText = this.resultsPerPage[0], let slcRText = this.resultsPerPage[0],
slcROpts = this.resultsPerPage[1]; slcROpts = this.resultsPerPage[1];
var slcRSpan = createElm('span'); let slcRSpan = createElm('span');
slcRSpan.className = this.resultsSpanCssClass; slcRSpan.className = this.resultsSpanCssClass;
// results per page select is added to external element // results per page select is added to external element
if (!this.resultsPerPageTgtId) { if (!this.pageLengthTgtId) {
tf.setToolbar(); tf.setToolbar();
} }
var targetEl = !this.resultsPerPageTgtId ? let targetEl = !this.pageLengthTgtId ?
tf.rDiv : elm(this.resultsPerPageTgtId); tf.rDiv : elm(this.pageLengthTgtId);
slcRSpan.appendChild(createText(slcRText)); slcRSpan.appendChild(createText(slcRText));
var help = tf.feature('help'); let help = tf.feature('help');
if (help && help.btn) { if (help && help.btn) {
help.btn.parentNode.insertBefore(slcRSpan, help.btn); help.btn.parentNode.insertBefore(slcRSpan, help.btn);
help.btn.parentNode.insertBefore(slcR, help.btn); help.btn.parentNode.insertBefore(slcR, help.btn);
@ -667,31 +667,31 @@ export class Paging extends Feature {
targetEl.appendChild(slcR); targetEl.appendChild(slcR);
} }
for (var r = 0; r < slcROpts.length; r++) { for (let r = 0; r < slcROpts.length; r++) {
var currOpt = new Option(slcROpts[r], slcROpts[r], false, false); let currOpt = new Option(slcROpts[r], slcROpts[r], false, false);
slcR.options[r] = currOpt; slcR.options[r] = currOpt;
} }
addEvt(slcR, 'change', evt.slcResultsChange); addEvt(slcR, 'change', evt.slcResultsChange);
this.slcResultsTxt = slcRSpan; this.slcResultsTxt = slcRSpan;
this.resultsPerPageSlc = slcR; this.pageLengthSlc = slcR;
} }
/** /**
* Remove number of results per page UI elements * Remove number of results per page UI elements
*/ */
removeResultsPerPage() { removeResultsPerPage() {
var tf = this.tf; let tf = this.tf;
if (!tf.isInitialized() || !this.resultsPerPageSlc || if (!tf.isInitialized() || !this.pageLengthSlc ||
!this.resultsPerPage) { !this.resultsPerPage) {
return; return;
} }
if (this.resultsPerPageSlc) { if (this.pageLengthSlc) {
removeElm(this.resultsPerPageSlc); removeElm(this.pageLengthSlc);
} }
if (this.slcResultsTxt) { if (this.slcResultsTxt) {
removeElm(this.slcResultsTxt); removeElm(this.slcResultsTxt);
} }
this.resultsPerPageSlc = null; this.pageLengthSlc = null;
this.slcResultsTxt = null; this.slcResultsTxt = null;
} }
@ -700,7 +700,7 @@ export class Paging extends Feature {
* @param {Number} index Index of the page (0-n) * @param {Number} index Index of the page (0-n)
*/ */
changePage(index) { changePage(index) {
var tf = this.tf; let tf = this.tf;
if (!this.isEnabled()) { if (!this.isEnabled()) {
return; return;
@ -710,20 +710,20 @@ export class Paging extends Feature {
if (index === null) { if (index === null) {
index = this.pageSelectorType === SELECT ? index = this.pageSelectorType === SELECT ?
this.pagingSlc.options.selectedIndex : this.pagingSlc.value - 1; this.pageSlc.options.selectedIndex : this.pageSlc.value - 1;
} }
if (index >= 0 && index <= (this.nbPages - 1)) { if (index >= 0 && index <= (this.nbPages - 1)) {
this.onBeforeChangePage(this, (index + 1)); this.onBeforeChangePage(this, (index + 1));
this.currentPageNb = parseInt(index, 10) + 1; this.currentPageNb = parseInt(index, 10) + 1;
if (this.pageSelectorType === SELECT) { if (this.pageSelectorType === SELECT) {
this.pagingSlc.options[index].selected = true; this.pageSlc.options[index].selected = true;
} else { } else {
this.pagingSlc.value = this.currentPageNb; this.pageSlc.value = this.currentPageNb;
} }
this.startPagingRow = (this.pageSelectorType === SELECT) ? this.startPagingRow = (this.pageSelectorType === SELECT) ?
this.pagingSlc.value : (index * this.pagingLength); this.pageSlc.value : (index * this.pageLength);
this.groupByPage(); this.groupByPage();
@ -742,7 +742,7 @@ export class Paging extends Feature {
return; return;
} }
this.resultsPerPageSlc.value = val; this.pageLengthSlc.value = val;
this.onChangeResultsPerPage(); this.onChangeResultsPerPage();
} }
@ -757,44 +757,44 @@ export class Paging extends Feature {
} }
let { let {
resultsPerPageSlc: slcR, pageSelectorType, pagingSlc, emitter pageLengthSlc: slcR, pageSelectorType, pageSlc, emitter
} = this; } = this;
emitter.emit('before-page-length-change', tf); emitter.emit('before-page-length-change', tf);
let slcIndex = slcR.selectedIndex; let slcIndex = slcR.selectedIndex;
let slcPagesSelIndex = (pageSelectorType === SELECT) ? let slcPagesSelIndex = (pageSelectorType === SELECT) ?
pagingSlc.selectedIndex : parseInt(pagingSlc.value - 1, 10); pageSlc.selectedIndex : parseInt(pageSlc.value - 1, 10);
this.pagingLength = parseInt(slcR.options[slcIndex].value, 10); this.pageLength = parseInt(slcR.options[slcIndex].value, 10);
this.startPagingRow = this.pagingLength * slcPagesSelIndex; this.startPagingRow = this.pageLength * slcPagesSelIndex;
if (!isNaN(this.pagingLength)) { if (!isNaN(this.pageLength)) {
if (this.startPagingRow >= tf.nbFilterableRows) { if (this.startPagingRow >= tf.nbFilterableRows) {
this.startPagingRow = (tf.nbFilterableRows - this.pagingLength); this.startPagingRow = (tf.nbFilterableRows - this.pageLength);
} }
this.setPagingInfo(); this.setPagingInfo();
if (pageSelectorType === SELECT) { if (pageSelectorType === SELECT) {
let slcIdx = let slcIdx =
(pagingSlc.options.length - 1 <= slcPagesSelIndex) ? (pageSlc.options.length - 1 <= slcPagesSelIndex) ?
(pagingSlc.options.length - 1) : slcPagesSelIndex; (pageSlc.options.length - 1) : slcPagesSelIndex;
pagingSlc.options[slcIdx].selected = true; pageSlc.options[slcIdx].selected = true;
} }
} }
emitter.emit('after-page-length-change', tf, this.pagingLength); emitter.emit('after-page-length-change', tf, this.pageLength);
} }
/** /**
* Re-set page nb at page re-load * Re-set page nb at page re-load
*/ */
resetPage() { resetPage() {
var tf = this.tf; let tf = this.tf;
if (!this.isEnabled()) { if (!this.isEnabled()) {
return; return;
} }
this.emitter.emit('before-reset-page', tf); this.emitter.emit('before-reset-page', tf);
var pgNb = tf.feature('store').getPageNb(); let pgNb = tf.feature('store').getPageNb();
if (pgNb !== '') { if (pgNb !== '') {
this.changePage((pgNb - 1)); this.changePage((pgNb - 1));
} }
@ -805,15 +805,15 @@ export class Paging extends Feature {
* Re-set page length value at page re-load * Re-set page length value at page re-load
*/ */
resetPageLength() { resetPageLength() {
var tf = this.tf; let tf = this.tf;
if (!this.isEnabled()) { if (!this.isEnabled()) {
return; return;
} }
this.emitter.emit('before-reset-page-length', tf); this.emitter.emit('before-reset-page-length', tf);
var pglenIndex = tf.feature('store').getPageLength(); let pglenIndex = tf.feature('store').getPageLength();
if (pglenIndex !== '') { if (pglenIndex !== '') {
this.resultsPerPageSlc.options[pglenIndex].selected = true; this.pageLengthSlc.options[pglenIndex].selected = true;
this.changeResultsPerPage(); this.changeResultsPerPage();
} }
this.emitter.emit('after-reset-page-length', tf, pglenIndex); this.emitter.emit('after-reset-page-length', tf, pglenIndex);
@ -827,16 +827,16 @@ export class Paging extends Feature {
return; return;
} }
var evt = this.evt; let evt = this.evt;
if (this.pagingSlc) { if (this.pageSlc) {
if (this.pageSelectorType === SELECT) { if (this.pageSelectorType === SELECT) {
removeEvt(this.pagingSlc, 'change', evt.slcPagesChange); removeEvt(this.pageSlc, 'change', evt.slcPagesChange);
} }
else if (this.pageSelectorType === INPUT) { else if (this.pageSelectorType === INPUT) {
removeEvt(this.pagingSlc, 'keypress', evt._detectKey); removeEvt(this.pageSlc, 'keypress', evt._detectKey);
} }
removeElm(this.pagingSlc); removeElm(this.pageSlc);
} }
if (this.btnNextCont) { if (this.btnNextCont) {
@ -888,7 +888,7 @@ export class Paging extends Feature {
this.emitter.off(['change-page-results'], this.emitter.off(['change-page-results'],
(tf, pageLength) => this.changeResultsPerPage(pageLength)); (tf, pageLength) => this.changeResultsPerPage(pageLength));
this.pagingSlc = null; this.pageSlc = null;
this.nbPages = 0; this.nbPages = 0;
this.initialized = false; this.initialized = false;

View file

@ -157,9 +157,9 @@ export class RowsCounter extends Feature {
let pagingStartRow = parseInt(paging.startPagingRow, 10) + let pagingStartRow = parseInt(paging.startPagingRow, 10) +
((nbValidRows > 0) ? 1 : 0); ((nbValidRows > 0) ? 1 : 0);
let pagingEndRow = let pagingEndRow =
(pagingStartRow + paging.pagingLength) - 1 <= (pagingStartRow + paging.pageLength) - 1 <=
nbValidRows ? nbValidRows ?
pagingStartRow + paging.pagingLength - 1 : pagingStartRow + paging.pageLength - 1 :
nbValidRows; nbValidRows;
totTxt = pagingStartRow + this.fromToTextSeparator + totTxt = pagingStartRow + this.fromToTextSeparator +
pagingEndRow + this.overText + nbValidRows; pagingEndRow + this.overText + nbValidRows;

View file

@ -765,9 +765,9 @@ export class TableFilter {
/** /**
* Enable paging component * Enable paging component
* @type {Boolean} * @type {Object|Boolean}
*/ */
this.paging = Boolean(f.paging); this.paging = isObj(f.paging) || Boolean(f.paging);
/** /**
* Number of hidden rows * Number of hidden rows

View file

@ -58,8 +58,9 @@ var tfConfig = {
rows_counter: true, rows_counter: true,
btn_reset: true, btn_reset: true,
status_bar: true, status_bar: true,
paging: true, paging: {
paging_length: 15, length: 15
},
enable_empty_option: true, enable_empty_option: true,
enable_non_empty_option: true, enable_non_empty_option: true,
enable_default_theme: true, enable_default_theme: true,

View file

@ -30,8 +30,9 @@
<script data-config> <script data-config>
var filtersConfig = { var filtersConfig = {
base_path: '../dist/tablefilter/', base_path: '../dist/tablefilter/',
paging: true, paging: {
results_per_page: ['Records: ', [10,25,50,100]], results_per_page: ['Records: ', [10, 25, 50, 100]]
},
state: { state: {
types: ['local_storage'], types: ['local_storage'],
filters: true, filters: true,

View file

@ -52,8 +52,9 @@
tf = new TableFilter('demo', { tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/', base_path: '../dist/tablefilter/',
rows_always_visible: [4, 9], rows_always_visible: [4, 9],
paging: true, paging: {
paging_length: 2 length: 2
}
}); });
tf.init(); tf.init();
var paging = tf.feature('paging'); var paging = tf.feature('paging');

View file

@ -6,8 +6,9 @@ var totRowIndex = table.getElementsByTagName('tr').length;
tf = new TableFilter('demo', { tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/', base_path: '../dist/tablefilter/',
col_types: ['string', 'string', 'number', 'number', 'number'], col_types: ['string', 'string', 'number', 'number', 'number'],
paging: true, paging: {
paging_length: 4, length: 4
},
rows_always_visible: [ rows_always_visible: [
totRowIndex-6, totRowIndex-6,
totRowIndex-5, totRowIndex-5,

View file

@ -10,8 +10,9 @@ var rowToAdd = tf.dom().rows[8];
var tf1 = new TableFilter('demo', { var tf1 = new TableFilter('demo', {
base_path: '../dist/tablefilter/', base_path: '../dist/tablefilter/',
rows_counter: true, rows_counter: true,
paging: true, paging: {
paging_length: 3 length: 3
}
}); });
module('Sanity checks'); module('Sanity checks');

View file

@ -28,8 +28,9 @@ test('Sanity checks', function() {
base_path: '../dist/tablefilter/', base_path: '../dist/tablefilter/',
filters_row_index: 3, filters_row_index: 3,
headers_row_index: 2, headers_row_index: 2,
paging: true, paging: {
paging_length: 3 length: 3
}
}); });
tf.init(); tf.init();

View file

@ -7,8 +7,9 @@ var tf = new TableFilter('demo', {
page_number: true, page_number: true,
page_length: true page_length: true
}, },
paging: true, paging: {
results_per_page: ['Records: ', [2, 4, 6]], results_per_page: ['Records: ', [2, 4, 6]]
}
}); });
tf.init(); tf.init();
var state = tf.feature('state'); var state = tf.feature('state');

View file

@ -1,7 +1,8 @@
var tf = new TableFilter('demo', { var tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/', base_path: '../dist/tablefilter/',
paging: true, paging: {
paging_length: 2, length: 2
},
results_per_page: ['Results per page ', [2,4,6]], results_per_page: ['Results per page ', [2,4,6]],
extensions: [{ extensions: [{
name: 'sort', name: 'sort',
@ -15,7 +16,7 @@ var paging = tf.feature('paging');
module('Sanity checks'); module('Sanity checks');
test('Paging component', function() { test('Paging component', function() {
notEqual(paging, null, 'Paging instanciated'); notEqual(paging, null, 'Paging instanciated');
deepEqual(paging.pagingLength, 2, 'Paging length'); deepEqual(paging.pageLength, 2, 'Paging length');
deepEqual(paging.nbPages, 4, 'Number of pages'); deepEqual(paging.nbPages, 4, 'Number of pages');
}); });
test('Sort extension', function() { test('Sort extension', function() {
@ -31,14 +32,14 @@ test('It contains options', function() {
var sort = tf.extension('sort'); var sort = tf.extension('sort');
sort.sortByColumnIndex(0); sort.sortByColumnIndex(0);
deepEqual(paging.pagingSlc.options.length, 4, 'Expected options number'); deepEqual(paging.pageSlc.options.length, 4, 'Expected options number');
}); });
test('Can select a page', function() { test('Can select a page', function() {
var sort = tf.extension('sort'); var sort = tf.extension('sort');
sort.sortByColumnIndex(1); sort.sortByColumnIndex(1);
paging.setPage(3); paging.setPage(3);
deepEqual(paging.pagingSlc.selectedIndex, 2, 'Expected selected option'); deepEqual(paging.pageSlc.selectedIndex, 2, 'Expected selected option');
}); });
module('Changing pages when column is sorted (issue #70)'); module('Changing pages when column is sorted (issue #70)');

View file

@ -1,9 +1,10 @@
var tf = new TableFilter('demo', { var tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/', base_path: '../dist/tablefilter/',
paging: true, paging: {
paging_length: 2, length: 2,
results_per_page: ['Results per page ', [2, 4, 6]] results_per_page: ['Results per page ', [2, 4, 6]]
}
}); });
tf.init(); tf.init();
@ -11,7 +12,7 @@ var paging = tf.feature('paging');
module('Sanity checks'); module('Sanity checks');
test('Paging component', function() { test('Paging component', function() {
notEqual(paging, null, 'Paging instanciated'); notEqual(paging, null, 'Paging instanciated');
deepEqual(paging.pagingLength, 2, 'Paging length'); deepEqual(paging.pageLength, 2, 'Paging length');
deepEqual(paging.nbPages, 4, 'Number of pages'); deepEqual(paging.nbPages, 4, 'Number of pages');
}); });
module('Feature interface'); module('Feature interface');
@ -60,8 +61,8 @@ test('Can check is enabled', function() {
module('UI elements'); module('UI elements');
test('Paging UI elements', function() { test('Paging UI elements', function() {
notEqual(paging.pagingSlc, null, 'Paging drop-down element'); notEqual(paging.pageSlc, null, 'Paging drop-down element');
notEqual(paging.resultsPerPageSlc, null, notEqual(paging.pageLengthSlc, null,
'Number of results per page drop-down element'); 'Number of results per page drop-down element');
notEqual(paging.btnNextCont, null, 'Next button container element'); notEqual(paging.btnNextCont, null, 'Next button container element');
notEqual(paging.btnPrevCont, null, 'Previous button container element'); notEqual(paging.btnPrevCont, null, 'Previous button container element');
@ -71,8 +72,8 @@ test('Paging UI elements', function() {
test('Destroy Paging component', function() { test('Destroy Paging component', function() {
paging.destroy(); paging.destroy();
deepEqual(paging.pagingSlc, null, 'Paging drop-down element'); deepEqual(paging.pageSlc, null, 'Paging drop-down element');
deepEqual(paging.resultsPerPageSlc, null, 'Paging drop-down element'); deepEqual(paging.pageLengthSlc, null, 'Paging drop-down element');
deepEqual(paging.btnNextCont, null, 'Next button container element'); deepEqual(paging.btnNextCont, null, 'Next button container element');
deepEqual(paging.btnPrevCont, null, 'Previous button container element'); deepEqual(paging.btnPrevCont, null, 'Previous button container element');
deepEqual(paging.btnLastCont, null, 'Last button container element'); deepEqual(paging.btnLastCont, null, 'Last button container element');
@ -83,7 +84,7 @@ test('Destroy Paging component', function() {
test('Reset Paging component', function() { test('Reset Paging component', function() {
paging.reset(); paging.reset();
paging.setPage(2); paging.setPage(2);
notEqual(paging.pagingSlc, null, 'Paging drop-down element'); notEqual(paging.pageSlc, null, 'Paging drop-down element');
}); });
module('Behaviour'); module('Behaviour');
@ -92,7 +93,7 @@ test('Set page', function() {
deepEqual(paging.getPage(), 1, 'Expected page number'); deepEqual(paging.getPage(), 1, 'Expected page number');
paging.setPage(3); paging.setPage(3);
deepEqual(paging.getPage(), 3, 'Expected page number'); deepEqual(paging.getPage(), 3, 'Expected page number');
deepEqual(paging.pagingSlc.selectedIndex, 2, deepEqual(paging.pageSlc.selectedIndex, 2,
'Expected page number in paging drop-down selector'); 'Expected page number in paging drop-down selector');
}); });
@ -121,8 +122,8 @@ test('Can set page with command', function() {
}); });
test('Set page via drop-down page selector', function() { test('Set page via drop-down page selector', function() {
paging.pagingSlc.selectedIndex = 3; paging.pageSlc.selectedIndex = 3;
paging.changePage(paging.pagingSlc.selectedIndex); paging.changePage(paging.pageSlc.selectedIndex);
deepEqual(paging.getPage(), 4, 'Expected page number'); deepEqual(paging.getPage(), 4, 'Expected page number');
}); });
@ -145,10 +146,10 @@ test('Filter with dummy value', function() {
test('Set results per page', function() { test('Set results per page', function() {
tf.clearFilters(); tf.clearFilters();
paging.changeResultsPerPage('4'); paging.changeResultsPerPage('4');
deepEqual(paging.pagingLength, 4, 'Expected page length'); deepEqual(paging.pageLength, 4, 'Expected page length');
deepEqual(paging.nbPages, 2, 'Expected number of pages'); deepEqual(paging.nbPages, 2, 'Expected number of pages');
paging.changeResultsPerPage('6'); paging.changeResultsPerPage('6');
deepEqual(paging.pagingLength, 6, 'Expected page length'); deepEqual(paging.pageLength, 6, 'Expected page length');
deepEqual(paging.nbPages, 2, 'Expected number of pages'); deepEqual(paging.nbPages, 2, 'Expected number of pages');
}); });
@ -159,16 +160,17 @@ test('Grid layout with paging', function() {
tf = new TableFilter('demo', { tf = new TableFilter('demo', {
base_path: '../dist/tablefilter/', base_path: '../dist/tablefilter/',
grid_layout: true, grid_layout: true,
paging: true, paging: {
paging_length: 2, length: 2,
results_per_page: ['Results per page ', [2,4,6]] results_per_page: ['Results per page ', [2, 4, 6]]
}
}); });
tf.init(); tf.init();
paging = tf.feature('paging'); paging = tf.feature('paging');
notEqual(paging.pagingSlc, null, 'Paging drop-down element'); notEqual(paging.pageSlc, null, 'Paging drop-down element');
notEqual(paging.resultsPerPageSlc, null, notEqual(paging.pageLengthSlc, null,
'Number of results per page drop-down element'); 'Number of results per page drop-down element');
notEqual(paging.btnNextCont, null, 'Next button container element'); notEqual(paging.btnNextCont, null, 'Next button container element');
notEqual(paging.btnPrevCont, null, 'Previous button container element'); notEqual(paging.btnPrevCont, null, 'Previous button container element');
@ -209,8 +211,8 @@ test('Can set page with command', function() {
}); });
test('Set page via drop-down page selector', function() { test('Set page via drop-down page selector', function() {
paging.pagingSlc.selectedIndex = 3; paging.pageSlc.selectedIndex = 3;
paging.changePage(paging.pagingSlc.selectedIndex); paging.changePage(paging.pageSlc.selectedIndex);
deepEqual(paging.getPage(), 4, 'Expected page number'); deepEqual(paging.getPage(), 4, 'Expected page number');
}); });
@ -233,10 +235,10 @@ test('Filter with dummy value', function() {
test('Set results per page', function() { test('Set results per page', function() {
tf.clearFilters(); tf.clearFilters();
paging.changeResultsPerPage('4'); paging.changeResultsPerPage('4');
deepEqual(paging.pagingLength, 4, 'Expected page length'); deepEqual(paging.pageLength, 4, 'Expected page length');
deepEqual(paging.nbPages, 2, 'Expected number of pages'); deepEqual(paging.nbPages, 2, 'Expected number of pages');
paging.changeResultsPerPage('6'); paging.changeResultsPerPage('6');
deepEqual(paging.pagingLength, 6, 'Expected page length'); deepEqual(paging.pageLength, 6, 'Expected page length');
deepEqual(paging.nbPages, 2, 'Expected number of pages'); deepEqual(paging.nbPages, 2, 'Expected number of pages');
}); });
@ -251,7 +253,7 @@ test('Set results per page when no valid rows', function() {
paging.changeResultsPerPage('4'); paging.changeResultsPerPage('4');
// assert // assert
deepEqual(paging.resultsPerPageSlc.value, '4', 'Select page length option'); deepEqual(paging.pageLengthSlc.value, '4', 'Select page length option');
deepEqual(paging.getPage(), 1, 'Expected page number'); deepEqual(paging.getPage(), 1, 'Expected page number');
}); });
@ -260,7 +262,7 @@ test('can destroy and init TableFilter', function() {
tf.destroy(); tf.destroy();
tf.init(); tf.init();
notEqual(paging, null, 'Paging instanciated'); notEqual(paging, null, 'Paging instanciated');
deepEqual(paging.pagingLength, 2, 'Paging length'); deepEqual(paging.pageLength, 2, 'Paging length');
deepEqual(paging.nbPages, 4, 'Number of pages'); deepEqual(paging.nbPages, 4, 'Number of pages');
}); });

View file

@ -85,8 +85,9 @@ test('RowsCounter component with paging', function() {
separator: '~', separator: '~',
over_text: ' \\ ' over_text: ' \\ '
}, },
paging: true, paging: {
paging_length: 3 length: 3
}
}); });
tf.init(); tf.init();
equal(tf.feature('rowsCounter').label.innerHTML, equal(tf.feature('rowsCounter').label.innerHTML,

View file

@ -7,8 +7,9 @@ var tf = new TableFilter('demo', {
page_number: true, page_number: true,
page_length: true page_length: true
}, },
paging: true, paging: {
results_per_page: ['Records: ', [2, 4, 6]], results_per_page: ['Records: ', [2, 4, 6]]
}
}); });
tf.init(); tf.init();
var state = tf.feature('state'); var state = tf.feature('state');

View file

@ -7,8 +7,9 @@ var tf = new TableFilter('demo', {
page_number: true, page_number: true,
page_length: true page_length: true
}, },
paging: true, paging: {
results_per_page: ['Records: ', [2, 4, 6]], results_per_page: ['Records: ', [2, 4, 6]],
}
}); });
tf.init(); tf.init();
var state = tf.feature('state'); var state = tf.feature('state');