Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tablesorter widget.js wrong loop count #448

Closed
hempel opened this issue Dec 2, 2013 · 1 comment
Closed

Tablesorter widget.js wrong loop count #448

hempel opened this issue Dec 2, 2013 · 1 comment
Labels

Comments

@hempel
Copy link

hempel commented Dec 2, 2013

Hey all,

when i tried to setup the latest version (2.14.2), i always got an error:

TypeError: c.cache[tbodyIndex].normalized[rowIndex] is undefined
cached = c.cache[tbodyIndex].normalized[rowIndex][columnIndex];
jquery.tablesorter.widgets.js (Line 858).

The error showed up, when i tried to use Tablesorter with TablesorterPager and activated filter widget. I tried to filter the first column with "Bu" and after seeing the results i tried to expand the filter to "Buc". It is reproducable, when you open the docs from current download-archive "docs/example-pager-filtered.html". Try to filter the first column (name) with "Sti" (typo for "Students"). Then, after the results (no results because of typo) are shown, just press backspace, that the current filter is "St". Then the error rises up.

I inspected the code and could see, that the "fixedHeight" property in pagerOptions adds a new row to your table to simulate the full length table.
The problem is, that the for-loop in jquery.tablesorter.widgets.js (line 842) loops through all lines in the table. The new added tr.pagerSavedHeightSpacer can't be found in the cached table.

So i think that the error should rise every time you have a "shortened" table and try to change the filter value.

Possible solution:
Change row 827 from
$rows = $tbody.children('tr').not('.' + c.cssChildRow).not('.group-header');

to
$rows = $tbody.children('tr').not('.' + c.cssChildRow).not('.group-header').not(c.selectorRemove);

@Mottie
Copy link
Owner

Mottie commented Dec 2, 2013

Hi @hempel!

Thanks for working this issue out, I'll have a look at it and hopefully have it fixed in the next update!

@Mottie Mottie closed this as completed in cbf501d Dec 2, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants