mirror of
https://github.com/koalyptus/TableFilter.git
synced 2024-05-23 08:42:18 +02:00
Fixed search yielding no matches under paging
This commit is contained in:
parent
4784b3fbde
commit
1ea547e19b
7
dist/tablefilter/tablefilter.js
vendored
7
dist/tablefilter/tablefilter.js
vendored
File diff suppressed because one or more lines are too long
2
dist/tablefilter/tf-1.js
vendored
2
dist/tablefilter/tf-1.js
vendored
|
@ -1,6 +1,6 @@
|
|||
/**
|
||||
* TableFilter v0.0.0 by Max Guglielmi
|
||||
* build date: 2015-07-14T13:48:08.344Z
|
||||
* build date: 2015-07-15T13:30:52.392Z
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ export class Paging{
|
|||
}
|
||||
|
||||
var isRowValid = row.getAttribute('validRow');
|
||||
if(Types.isNull(isRowValid) || Boolean(isRowValid)){
|
||||
if(Types.isNull(isRowValid) || Boolean(isRowValid==='true')){
|
||||
tf.validRowsIndex.push(j);
|
||||
}
|
||||
}
|
||||
|
@ -394,13 +394,8 @@ export class Paging{
|
|||
mdiv.style.visibility = 'visible';
|
||||
if(this.pageSelectorType === tf.fltTypeSlc){
|
||||
for(var z=0; z<this.nbPages; z++){
|
||||
var currOpt = new Option(
|
||||
(z+1),
|
||||
z*this.pagingLength,
|
||||
false,
|
||||
false
|
||||
);
|
||||
this.pagingSlc.options[z] = currOpt;
|
||||
var opt = Dom.createOpt(z+1, z*this.pagingLength, false);
|
||||
this.pagingSlc.options[z] = opt;
|
||||
}
|
||||
} else{
|
||||
//input type
|
||||
|
@ -437,9 +432,7 @@ export class Paging{
|
|||
var isRowValid = r.getAttribute('validRow');
|
||||
|
||||
if(h>=this.startPagingRow && h<endPagingRow){
|
||||
// if(r.getAttribute('validRow')==='true' ||
|
||||
// !r.getAttribute('validRow')){
|
||||
if(Types.isNull(isRowValid) || Boolean(isRowValid)){
|
||||
if(Types.isNull(isRowValid) || Boolean(isRowValid==='true')){
|
||||
r.style.display = '';
|
||||
}
|
||||
if(tf.alternateBgs && alternateRows){
|
||||
|
|
|
@ -63,10 +63,10 @@ test('Set page', function() {
|
|||
'Expected page number in paging drop-down selector');
|
||||
});
|
||||
|
||||
|
||||
test('Set page via drop-down page selector', function() {
|
||||
paging.pagingSlc.selectedIndex = 2;
|
||||
deepEqual(paging.getPage(), 3, 'Expected page number');
|
||||
paging.pagingSlc.selectedIndex = 3;
|
||||
paging.changePage(paging.pagingSlc.selectedIndex);
|
||||
deepEqual(paging.getPage(), 4, 'Expected page number');
|
||||
});
|
||||
|
||||
test('Filter from non starting page', function() {
|
||||
|
@ -78,6 +78,13 @@ test('Filter from non starting page', function() {
|
|||
1, 'Expected visible rows after page change');
|
||||
});
|
||||
|
||||
test('Filter with dummy value', function() {
|
||||
tf.clearFilters();
|
||||
tf.setFilterValue(0, 'dfsdf');
|
||||
tf.filter();
|
||||
deepEqual(tf.validRowsIndex.length, 0, 'Expected valid rows');
|
||||
});
|
||||
|
||||
test('Set results per page', function() {
|
||||
tf.clearFilters();
|
||||
paging.resultsPerPageSlc.options[1].selected = true;
|
||||
|
@ -126,6 +133,12 @@ test('Set page', function() {
|
|||
deepEqual(paging.getPage(), 3, 'Expected page number');
|
||||
});
|
||||
|
||||
test('Set page via drop-down page selector', function() {
|
||||
paging.pagingSlc.selectedIndex = 3;
|
||||
paging.changePage(paging.pagingSlc.selectedIndex);
|
||||
deepEqual(paging.getPage(), 4, 'Expected page number');
|
||||
});
|
||||
|
||||
test('Filter from non starting page', function() {
|
||||
tf.setFilterValue(1, 'Perth');
|
||||
tf.filter();
|
||||
|
@ -135,7 +148,15 @@ test('Filter from non starting page', function() {
|
|||
1, 'Expected visible rows after page change');
|
||||
});
|
||||
|
||||
test('Filter with dummy value', function() {
|
||||
tf.clearFilters();
|
||||
tf.setFilterValue(0, 'dfsdf');
|
||||
tf.filter();
|
||||
deepEqual(tf.validRowsIndex.length, 0, 'Expected valid rows');
|
||||
});
|
||||
|
||||
test('Set results per page', function() {
|
||||
tf.clearFilters();
|
||||
paging.resultsPerPageSlc.options[1].selected = true;
|
||||
paging.changeResultsPerPage();
|
||||
deepEqual(paging.pagingLength, 4, 'Expected page length');
|
||||
|
|
Loading…
Reference in a new issue