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

Issue with updateCell Event with Multiple tbody's on Page #319

Closed
isuTony opened this issue May 31, 2013 · 1 comment
Closed

Issue with updateCell Event with Multiple tbody's on Page #319

isuTony opened this issue May 31, 2013 · 1 comment
Labels

Comments

@isuTony
Copy link

isuTony commented May 31, 2013

When I added a trigger to call the updateCell event, I noticed the cache was not being updated. After a little troubleshooting, I realized the code in the "updateCell.tablesorter" event handler was not finding the tbody for the table cell.

Unfortunately for me, in the particular web page containing the table for which I am using the tablesorter plugin, this table is nested within another table, thus causing the issue.

The code in question is on lines 730-733 of file jquery.tablesorter.js, in the bind method for "updateCell.tablesorter":

                // update cache - format: function(s, table, cell, cellIndex)
                // no closest in jQuery v1.2.6 - tbdy = $tb.index( $(cell).closest('tbody') ),$row = $(cell).closest('tr');
                tbdy = $tb.index( $(cell).parents('tbody').filter(':last') ),
                $row = $(cell).parents('tr').filter(':last');

Taking into account the commented out code regarding the 'closest' function and after some testing, I believe the filter after the call to 'parents' should be for the first value in order to mimic 'closest', rather than the last value.

e.g.

                $cell = $(cell),
                tbdy = $tb.index($cell.parents('tbody').filter(':first')),
                $row = $cell.parents('tr').filter(':first');

This seemed to work for me.

Thanks for all your hard work on this great plugin.

@Mottie
Copy link
Owner

Mottie commented May 31, 2013

Ahh, you're right! Thanks for pointing that out, I'll fix it right now. :)

@Mottie Mottie closed this as completed in 2af097a Jun 1, 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