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

rickmanelius’s picture

Status: Active » Fixed

Set 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!

colin_young’s picture

Status: Fixed » Active

That'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?

rickmanelius’s picture

Ah, 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.

colin_young’s picture

Thanks. 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.

rickmanelius’s picture

Category: support » feature

Hi 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.

colin_young’s picture

Any 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.

dawehner’s picture

views/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.

colin_young’s picture

UPDATE: 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.

laraz’s picture