For some work I'm doing on a project, I'm using the Pager class.
This is really good (and I've learned a lot along the way), but I would like to use a slider (like http://jqueryui.com/slider/) to allow the user to jump to different places in the paged results.
I think that to do this right I need to find the total number of results and then tell Pager to serve the results that are associated with that selected spot on the slider.
For example, when the user selects a point 25% along the slider, I'll be able to find out there are 1024 results and jump to the set containing the 256th result.
For other pager tasks, I've been using the IndexPager, but this pager is obviously the wrong one for this job.
Is there a better one? Is there a pager-with-slider implementation out there already that I'm just not aware of?
This is a tricky one to get right; we try to make pagers work on natural indices like timestamps, revision ids, or namespace/title pairs. As such, it's *easy* to look up the "first" and "last" entries but very hard to find the "50%" entry.
If it's something time-based you can fairly easily hook up a slider to a date/time range, but there's no guarantee there'll be even numbers of items on each side.
IndexPager would let you dive right in to a row offset for any index type, but would be much more expensive in lookups on the table (and leaves unstable URLs whose contents change as the database changes).
On Mon, Jun 3, 2013 at 10:58 AM, Mark A. Hershberger mah@everybody.orgwrote:
For some work I'm doing on a project, I'm using the Pager class.
This is really good (and I've learned a lot along the way), but I would like to use a slider (like http://jqueryui.com/slider/) to allow the user to jump to different places in the paged results.
I think that to do this right I need to find the total number of results and then tell Pager to serve the results that are associated with that selected spot on the slider.
For example, when the user selects a point 25% along the slider, I'll be able to find out there are 1024 results and jump to the set containing the 256th result.
For other pager tasks, I've been using the IndexPager, but this pager is obviously the wrong one for this job.
Is there a better one? Is there a pager-with-slider implementation out there already that I'm just not aware of?
Love alone reveals the true shape of the universe. -- "Everywhere Present", Stephen Freeman
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On 06/03/2013 02:09 PM, Brion Vibber wrote:
This is a tricky one to get right
I'm glad it isn't just me. :)
If it's something time-based you can fairly easily hook up a slider to a date/time range, but there's no guarantee there'll be even numbers of items on each side.
I'll look at what I have a bit more, but I'm afraid it is simply based on titles, so all I've got is row offsets.
IndexPager would let you dive right in to a row offset for any index type, but would be much more expensive in lookups on the table (and leaves unstable URLs whose contents change as the database changes).
Right.
I'm not too worried about unstable URLs at this point (maybe later), but do you have an example for row offsets? I'm probably missing something, but I don't see an easy way to get the total # of rows at this point. Since I'm using an older version of MW for this (1.13 -- not my choice!) is there something I need to backport? I've looked around already, but I'm hoping there is just something I'm missing.
Mark.
On Mon, Jun 3, 2013 at 11:18 AM, Mark A. Hershberger mah@everybody.orgwrote:
IndexPager would let you dive right in to a row offset for any index
type,
but would be much more expensive in lookups on the table (and leaves unstable URLs whose contents change as the database changes).
Right.
I'm not too worried about unstable URLs at this point (maybe later), but do you have an example for row offsets? I'm probably missing something, but I don't see an easy way to get the total # of rows at this point. Since I'm using an older version of MW for this (1.13 -- not my choice!) is there something I need to backport? I've looked around already, but I'm hoping there is just something I'm missing.
I guess you'd just have to emit the query with a count(*).... it could be very expensive on a large table. :(
-- brion
On 06/03/2013 05:46 PM, Brion Vibber wrote:
I'm not too worried about unstable URLs at this point (maybe later), but do you have an example for row offsets? I'm probably missing something, but I don't see an easy way to get the total # of rows at this point. Since I'm using an older version of MW for this (1.13 -- not my choice!) is there something I need to backport? I've looked around already, but I'm hoping there is just something I'm missing.
I guess you'd just have to emit the query with a count(*).... it could be very expensive on a large table. :(
I was afraid of that.
wikitech-l@lists.wikimedia.org