You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while working with the tablesorter.widget.filter.js I came accross a situation where the table would not be filtered when the filter was changed.
Example:
Type
Priority
Foo
Low
Bar
Medium
FooBar
High
In this example each row is assigned a value 0 | 1 | 2 so Foo and Low would both be assigned the value 0
Type
Priority
Value (for both columns)
Foo
Low
0
Bar
Medium
1
FooBar
High
2
Now if you were to set the Type filter to Foo intern the variable combinedFilters would contain the value 0 since it's a joined array of all filter values.
This happens twice actually: widget-filter.js Line: 886: combinedFilters = ( filters || [] ).join( '' ); widget-filter.js Line: 1314: combinedFilters = ( filters || [] ).join( '' );
After filtering, the value of combinedFilters will be written into c.lastCombinedFilter widget-filter.js Line: 1502: c.lastCombinedFilter = combinedFilters;
If the next filter you set would also be of the value 0 the code would check if the values of the newly written combinedFilters would equal the value of c.lastCombinedFilter
Ok, sorry it's taken me so long to get around to this issue. This problem has been fixed in the master branch (demo). I plan on pushing a new release very soon.
Hello,
while working with the tablesorter.widget.filter.js I came accross a situation where the table would not be filtered when the filter was changed.
Example:
In this example each row is assigned a value
0 | 1 | 2
soFoo
andLow
would both be assigned the value0
Now if you were to set the
Type
filter toFoo
intern the variablecombinedFilters
would contain the value0
since it's a joined array of all filter values.This happens twice actually:
widget-filter.js Line: 886:
combinedFilters = ( filters || [] ).join( '' );
widget-filter.js Line: 1314:
combinedFilters = ( filters || [] ).join( '' );
After filtering, the value of
combinedFilters
will be written intoc.lastCombinedFilter
widget-filter.js Line: 1502:
c.lastCombinedFilter = combinedFilters;
If the next filter you set would also be of the value
0
the code would check if the values of the newly writtencombinedFilters
would equal the value ofc.lastCombinedFilter
widget-filter.js Line: 910-912:
Now both variables would be
0
so the code returns without filtering the table by the new filter.Solution:
In my project I changed the line 886: and 1314: to
combinedFilters = ( filters || [] ).join( ',' );
As I don't know if there is a better way to solve this I have not submitted a pull-request, I'll leave this to the people who know javascript.
The text was updated successfully, but these errors were encountered: