Active
Project:
Views (for Drupal 7)
Version:
7.x-3.x-dev
Component:
exposed filters
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Jan 2012 at 05:04 UTC
Updated:
12 Jun 2012 at 11:20 UTC
Is there a way currently to save the user's selection of items per page? It appears as though that is possible for the exposed filters, but not for the pager settings.
Comments
Comment #1
rickmanelius commentedSet the pager to full pager. Click the link to the right titled 'Paged, X items'. Scroll down, check "Expose items per page", and then set the different paging quantities.
Good luck!
Comment #2
colin_young commentedThat's what I've done. I see a drop-down allowing the user to select from the options for items per page that I've provided, but when they visit another page (i.e. away from the current view) and come back, the exposed filter settings are remembered (e.g. the taxonomy term the user selected) but the items per page are reset to the default, not whatever the user selected on the last visit. Should that be remembered?
Comment #3
rickmanelius commentedAh, my mistake. I didn't know you wanted that remembered...
I don't think that's possible as views is not using cookies to save said preferences.
Comment #4
colin_young commentedThanks. That's what I was trying to confirm (and make sure it wasn't a user-error on my end). Any idea how difficult that would be to implement? I'm kind of assuming that it's non-trivial otherwise it probably would have been provided along with the saved exposed filters, although I suppose it may have just been missed if it could use the same mechanism as is used to remember the exposed filter settings.
It does present a bit of a usability issue in that the items-per-page setting appears alongside the exposed filters in the UI, but only the exposed filters are saved.
Comment #5
rickmanelius commentedHi colin_young,
I take that back. I didn't realize that views is actually storing the user exposed filter preferences. In that case, it's equally likely that the pagination could be saved, it just was not implemented.
Moving this a feature request as I don't think it's a possibility right now and would require some coding to implement.
Comment #6
colin_young commentedAny clues where I might start looking? I'm willing to take a look at implementing it, but I'll need some help figuring out views code.
Comment #7
dawehnerviews/handlers/views_handler_filter.inc stores it via $_SESSION so a similar kind of technique should be used for exposed items per page as well.
Comment #8
colin_young commentedUPDATE: I think I see where it get restored in get_exposed_input in view.inc. I also see some pager stuff in there. I guess that's where I'll start playing around.
I see in store_exposed_input where the values are being saved, but how are they being restored? I can't find that (or don't understand what I'm seeing).
Also, I haven't extensively tested yet, but it appears as though they will only be saved for the duration of the current session, which makes some sense. I've been thinking along the lines of being able to persistently save user preferences, which got me thinking that it should be even more generic than just for views filters. Something like a module that would allow the administrator to choose which forms on the site could have default values saved for each user and whenever that form is displayed pre-fill those items. Does that make sense? Does it seem possible? I realize I've strayed a bit beyond views here :)
I still think I need to make a fix to save items-per-page for the duration of the session.
Thanks.
Comment #10
laraz commentedRead here:
http://drupal.org/node/1482424