[dev.icinga.com #2855] javascript refresh jumps to page top, not restoring previous scrolling position; add url param 'scroll=' #1025
Comments
Updated by ralfk on 2012-07-16 07:32:48 +00:00 See e.g. http://www.redips.net/javascript/maintain-scroll-position/ or http://codesnipp.it/javascript/scroll-to-anywhere-on-the-page-in-jquery on how to keep scroll position. Maybe that helps. |
Updated by mfriedrich on 2012-07-16 08:40:52 +00:00
|
Updated by mfriedrich on 2012-09-10 18:03:41 +00:00 i can confirm that behaviour. thing is - if we put up javascript to modify the url, we should possibly think of putting the complete cgi plus query string into it as well, not forgetting the framesource, like thruk does it. problem will be that the index.html is static and cannot determine which cgi to be called in the first place. |
Updated by mfriedrich on 2012-09-10 18:05:18 +00:00 though, putting javascript into index.html could possibly solve that issue as well, instead of thinking somewhat dynamic language like we had php, or could go perl now. |
Updated by mfriedrich on 2012-09-10 18:09:11 +00:00 http://www.liveintensely.com/2010/03/jquery-and-frames/ |
Updated by mfriedrich on 2012-09-11 16:22:04 +00:00
ok, for the original problem - i'm not really a javascript coder, nor do i know how to keep state during reloads within javascript (is that event possible without url tricks or cookies?). thing is, all browsers out there will know to use "ScrollTo", but the detection of the current scroll position is somewhat different.
attached is a try to get the current scroll position into a global variable, and after the reload, re-reading it again, scrolling the page. seems that the value is not kept within javascript / local cache. |
Updated by mfriedrich on 2012-09-11 16:42:47 +00:00 ok, using the url set trick (like we used to do previously with paused or not) from http://www.redips.net/javascript/maintain-scroll-position/?param1=a¶m2=b¶m3=c&scroll=319 it works, on a single page. |
Updated by mfriedrich on 2012-09-11 17:17:12 +00:00 that will possibly add a new javascript interpreted GET param onto the cgis which have page refreshing enabled. |
Updated by mfriedrich on 2012-09-11 17:18:46 +00:00
it will require a dedicated eventhandler, like described in the url, as you can only modify DOM elements, when the page is fully loaded - not directly after pushing the reload itsself. |
Updated by mfriedrich on 2012-09-11 17:24:40 +00:00
|
Updated by mfriedrich on 2012-09-11 17:26:35 +00:00
ok, more of a feature when adding something new. |
Updated by mfriedrich on 2012-09-11 17:34:04 +00:00
in dev/cgis - please test! |
Updated by mfriedrich on 2012-09-11 17:34:09 +00:00
|
Updated by mfriedrich on 2012-09-12 11:22:47 +00:00 tested ok on debian sid with
as well as windows 7 x64
|
Updated by ricardo on 2012-09-18 23:53:30 +00:00
Tested ok as well on OSX 10.8
on Windows XP
thanks Michael |
Updated by ralfk on 2012-10-19 11:16:30 +00:00 Thanks for fixing it. Well done. |
Updated by mfriedrich on 2014-12-08 09:27:23 +00:00
|
This issue has been migrated from Redmine: https://dev.icinga.com/issues/2855
Created by ralfk on 2012-07-16 07:24:00 +00:00
Assignee: mfriedrich
Status: Resolved (closed on 2012-09-18 23:53:30 +00:00)
Target Version: 1.8
Last Update: 2014-12-08 09:27:23 +00:00 (in Redmine)
In previous Icinga releases (e.g. 1.6) the page refresh did not change the vertical position of the page. That means, if a user scrolled down to the bottom of the page in order to view a certain part of the page, the page position wasn't changed after the automated refresh.
This behavior changed after Icinga 1.7 introduced a new refresh method based on JavaScript (see https://dev.icinga.org/issues/2119 and https://www.icinga.org/2012/05/15/icinga-1-7-released/). Now, after a page refresh the browser always jumps to the top of the page.
Is there a chance to implement the old behavior into the new JavaScript code?
Changesets
2012-09-11 17:27:32 +00:00 by mfriedrich 348658c
2012-09-11 17:36:28 +00:00 by mfriedrich 39437ca
Relations:
The text was updated successfully, but these errors were encountered: