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

page calculation bug #468

Closed
christhomas opened this issue Dec 20, 2013 · 4 comments
Closed

page calculation bug #468

christhomas opened this issue Dec 20, 2013 · 4 comments
Labels

Comments

@christhomas
Copy link
Contributor

I found in the pager the following code today

https://github.com/Mottie/tablesorter/blob/master/addons/pager/jquery.tablesorter.pager.js#L565

p.totalPages = Math.ceil( Math.min( p.totalPages, p.filteredPages ) / p.size );

surely that should be

p.totalPages = Math.ceil( Math.min( p.totalRows, p.filteredRows ) / p.size );

Cause here it appears to be dividing the number of pages by the size to obtain the number of pages, this is wrong, it should divide the number of rows by the size.

I've fixed my local copy and it appears to work, the calculation is correct, so can somebody else test this too?

@christhomas
Copy link
Contributor Author

I think what happens is that the calculation is wrong, but it doesnt matter in most cases because then afterwards there is another calculation which "covers" the problem and makes it correct, so you never appear to see the original error.

although of course, why it's being recalculated multiple times (obviously it is, otherwise this error would have surfaced before) I don't know, so now I'm trying to look into this.

@Mottie
Copy link
Owner

Mottie commented Dec 20, 2013

Hi @christhomas!

Yeah you're right, it is a bug... it's within the "enable" pager code, so it is run when the pager is initialized or enabled (after disabling).

It does get corrected again, so you're right that you normally don't see this issue. Anyway, thanks! I'll fix it for the next update.

@christhomas
Copy link
Contributor Author

good stuff! I'll continue with my hunt :)

@Mottie Mottie closed this as completed in e3a4f37 Dec 21, 2013
@Mottie
Copy link
Owner

Mottie commented Dec 21, 2013

So far, I've only pushed these changes to the remote master... I have yet to tag and update the gh-pages. I'm going away for two weeks on Monday, so I'll try to get as many bug fixes in before then and tag the next update before I leave.

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