wesnolte / Pajinate

A jQuery Pagination Plugin
http://th3silverlining.com/2010/04/15/pajination-a-jquery-pagination-plugin/
MIT License
207 stars 97 forks source link

Not honoring items per page - bug in viewPage() #10

Closed jayalfredprufrock closed 13 years ago

jayalfredprufrock commented 13 years ago

A few lines down in the viewPage() function, the items_per_page variable is added to the viewPage() parameter like so:

end_on = start_from + ipp;

However, the ipp variable is pulled out of element storage, and thus is treated as a string. So if you had items_per_page set to "2" and wanted to view page "3", the variable end_on would be set to "23" instead of "5".

I'm kind of perplexed this bug hasn't been addressed in at least one of the forks. I suppose maybe the reason this issue has gone unnoticed is that perhaps the jquery element data codebase has changed in a recent version. Anyways, hopefully somebody who has git setup will correct this problem and it will be merged with the master branch.

jayalfredprufrock commented 13 years ago

I went ahead and forked the fix, so ignore my comments here.

wesnolte commented 13 years ago

Yeah this bug would've been noticed pretty quickly so I'm not sure what's changed - I'm guessing you're correct about the jquery lib changing. This is weird because such a change would've probably broken jQuery code in many other apps!

The bug isn't apparent in the version of jQuery that I'm using. What version are you using?

jayalfredprufrock commented 13 years ago

Hey Wes, I've been using the latest version of jQuery (1.6.4 I think), and testing in firefox 8 beta (which I suppose could explain things as well). Also, please forgive me extraneous git actions...I'm new to this, and I'm not always sure what proper fork etiquette is. Anyways, thanks for looking into this!

wesnolte commented 13 years ago

I'm not a git guru either so no worries. There must be some peculiarity with that combination of lib + browser because there have been over 200k downloads of pajinate without that specific issue. What I like is that your fix can only do good ;) Once again, thanks for the help.