Closed (won't fix)
Project:
Views (for Drupal 7)
Version:
7.x-3.3
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Dec 2010 at 21:19 UTC
Updated:
30 Jul 2014 at 22:51 UTC
Jump to comment: Most recent
Comments
Comment #1
dawehnerCurrently it's not possible without custom coding.
You could fix the issue easily if you disable ajax on the pagers.
Comment #2
yngens commentedDisabling ajax does not help. Without ajax when you click to next page, it correctly opens http://mysite/photo/1/12757.7604?page=1, however as soon as you click any page '?page=1' part in URL is gone and the block's pager sets back to initial position.
I believe remembering last clicked link is very much needed functionality for the views. So if possible please leave this issue open till someone comes with the solution. For example, the same logic with using cookies could be used as in #354199: Remember last clicked tab
Comment #3
merlinofchaos commentedSorry, this is not a feature Views supports. Neither does Drupal's core pager.
Comment #4
seanbToday I needed this feature for a client of ours. The code below remembers the last page visited for every view display in the session. It only works for ajax views, because the normal pager doesn't add the view name and display id in the URL. So you can't really tell for wich view to set the page (any ideas?). You can customize it further by adding checks for view names etc. Other additions are welcome, as I can see this only works for specific cases.
Comment #5
jussil commentedLast post was very helpful and easy solution in order to remember the ajaxified page. There was only one problem if you are using more than one views in the page. Last solution set the query param page directly which then affects all of the views thats are being called. Instead I used $view->pager['current_page'] to set only the desired views current page and this works like a charm.
Comment #6
laraz commentedI need this feature in drupal 7 and views version 7.x-3.3.
Does this feature works in Drupal 7?
$view->pager['current_page'] is not defined in drupal 7. How I get the current page?
All my pages access to the last else $_SESSION[$view_name]=0;
Comment #7
tomsm commentedI have created a custom module with the code mentioned in #4 but the pager is not remembered.
I also tried with the code of #6.
I use views 6.x-3.0 with drupal core 6.28.
This is the contents of my "custom_module.info" file:
And this is in my "custom_module.module" file:
What am I doing wrong? Do I need to change the name of the view?
Comment #8
rexmondo commentedHere is a solution that works in drupal 7 with views 3.x, as long as you have exposed filters on the view and the exposed filters are set to "remember last selection", in which case $_REQUEST will be populated if and only if you do ajax requests. This means that the view will load the last selected page when a new page with the same view is loaded.
Note that this is only tested in my system on pages that have one view of each type on the page, I'm not sure what will happen if you try to add the same view multiple times on a page, but i suspect it probably won't work.
Add the following code to a module to get this to work.
Comment #9
cvbuyten commentedIn my case the solution from Rexmondo didn't work because $_POST['page'] returned a comma separated string.
But using his example I got a working module
file: lastviewedpage.info
file: lastviewedpage.module
Comment #10
InesRg commentedThanks a lot for your answer !! It works for me too
Comment #11
marius-guenter commentedThis code is for "Insert Views" Views.
It also worked with ajax and Multilanguage Systems.
Here is my Code to solve the Problem:
First make a Module
Then put these Lines of code inside it.
Hope that helps.