A better way to paginate through results
I don't know about you, but I really hate when I have to paginate through results. Most sites really don't put much thought into how this is done. You typically get to select a couple of pages to either side of your current page, and sometimes they let you move from one end of the results to the other. If you are looking for something in the middle, you can look forward to doing a lot of clicking before you get there.
Well, at tipstrs, we came up with what we think is a better approach. You can't really see it in action yet since there aren't enough tips to trigger this sort of pagination, but rest assured, it's ready and waiting once the volume of tips gets large (hint, hint, nudge, nudge).
What we did was to look at this problem in terms of a simple search algorithm, modified slightly so that you get results which look pleasing to the human eye. Examples follow below.
Probably the best simple search algorithm is bisection (http://mathworld.wolfram.com/Bisection.html) . This type of search reaches a solution on the order of log(n) where n in this case is the number of pages. To apply this to the problem of pagination, we use bisection to determine the pages to show to the user between the current page and the upper and lower limits (the lower limit is always the first page). We then recursively reduce the interval until we reach the current page.
However, to make the results more pleasing to the human eye, there are two modifcations:
- Instead of straight bisection (where the interval is 0.5), we bisect using the golden ratio (http://en.wikipedia.org/wiki/Golden_ratio) which is ( sqrt(5) - 1 ) / 2.
- Instead of just showing the true value that should be used in the bisection, we show numbers that are rounded to some interval where the interval increases as the distance from the current page increases. In our case, the interval is 1 when the distance is 2 or less, it then goes to 2 when the distance is 10 or less, 5 when the distance is 50 or less, etc... (the sequence here is that the intervals are increasing as 1, 2, 5, 10, 20, 50, 100, etc and the distance to which they apply is the interval times the limit of the distance used in the previous interval). Um, okay, this sequence description is pretty bad, but hopefully you can see what I mean, and maybe someone can add a comment to explain what I mean.
Once you roll all that up, you actually end up with something pretty reasonable looking which has the added bonus that it should be much quicker to find a particular page. Here are some examples with various numbers of pages... from the reasonable to the out-of-hand. These should all work, so feel free to click on the lists to see how they change as you simulate paging through them.
| Rating: | 100% positive, 8 total Votes |
| Categories: | programming web coding web 2.0 |
| Added: | on Mar 08, 2007 at 12:33 pm |
| Added By: | tipstr |
| Searches: | page interval result distance web |

