You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Michael Heinen <mh...@recommind.com> on 2006/06/13 09:12:58 UTC

RE: JSF scroll issue

Hi,

The setFocus method is called in the body onload event.

rememberScrolling is called in the onSubmit event of the form:
<h:form id="docform" onsubmit="rememberScrolling();return true;">


Do you have a similar setup with scrollable div tags?
General autoscrolling can be enabled in web.xml:
    <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
    <param-value>false</param-value>
But this autoscrolling works only for the window scrollbars.

Hope this helps
Michael

PS: I sent this also to the list


-----Original Message-----
From: Satish Kumar Mummadi [mailto:mummsat@iit.edu] 
Sent: Montag, 12. Juni 2006 21:24
To: Michael Heinen
Subject: JSF scroll issue

Hi,

I came across your posting on the Internet for the code snippet to store
& retrieve a scrollbar previous scroll position...
http://mail-archives.apache.org/mod_mbox/myfaces-users/200603.mbox/%3CFE
13C981C8AA5A4DBAAC6E04248F11A5B3F259@ehost011-1.exch011.intermedia.net%3
E

I followed your note and created a Bean variable (HtmlInputHidden
docDivYScroller)

and I also added this on the JSF page
<h:inputHidden id="yscroller" binding="#{MyBean.docDivYScroller}"/>
<script type="text/javascript">
var yscroll = document.getElementById('docform:yscroller');
var docsdiv = document.getElementById('docsdiv');
function setFocus(){
  if (docsdiv!=null) {
     docsdiv.scrollTop=yscroll.value;
  }
}
function rememberScrolling() {
   if (docsdiv!=null) {
      yscroll.value = docsdiv.scrollTop;
   }
}

My question is how do I call these javascript functions? where do I need
to call them??

can you please help me with this

Thanks
Satish

</script>




Re: JSF scroll issue

Posted by Jeff Bischoff <jb...@klkurz.com>.
 > rememberScrolling is called in the onSubmit event of the form:
 > <h:form id="docform" onsubmit="rememberScrolling();return true;">

Take care returning "true" in javascript events like this, as it will 
skip the rest of the JSF lifecycle. Be sure this is actually what you want.

Regards,

Jeff Bischoff
Kenneth L Kurz & Assoc, Inc.

Michael Heinen wrote:
> Hi,
> 
> The setFocus method is called in the body onload event.
> 
> rememberScrolling is called in the onSubmit event of the form:
> <h:form id="docform" onsubmit="rememberScrolling();return true;">
> 
> 
> Do you have a similar setup with scrollable div tags?
> General autoscrolling can be enabled in web.xml:
>     <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
>     <param-value>false</param-value>
> But this autoscrolling works only for the window scrollbars.
> 
> Hope this helps
> Michael
> 
> PS: I sent this also to the list
> 
> 
> -----Original Message-----
> From: Satish Kumar Mummadi [mailto:mummsat@iit.edu] 
> Sent: Montag, 12. Juni 2006 21:24
> To: Michael Heinen
> Subject: JSF scroll issue
> 
> Hi,
> 
> I came across your posting on the Internet for the code snippet to store
> & retrieve a scrollbar previous scroll position...
> http://mail-archives.apache.org/mod_mbox/myfaces-users/200603.mbox/%3CFE
> 13C981C8AA5A4DBAAC6E04248F11A5B3F259@ehost011-1.exch011.intermedia.net%3
> E
> 
> I followed your note and created a Bean variable (HtmlInputHidden
> docDivYScroller)
> 
> and I also added this on the JSF page
> <h:inputHidden id="yscroller" binding="#{MyBean.docDivYScroller}"/>
> <script type="text/javascript">
> var yscroll = document.getElementById('docform:yscroller');
> var docsdiv = document.getElementById('docsdiv');
> function setFocus(){
>   if (docsdiv!=null) {
>      docsdiv.scrollTop=yscroll.value;
>   }
> }
> function rememberScrolling() {
>    if (docsdiv!=null) {
>       yscroll.value = docsdiv.scrollTop;
>    }
> }
> 
> My question is how do I call these javascript functions? where do I need
> to call them??
> 
> can you please help me with this
> 
> Thanks
> Satish
> 
> </script>
> 
> 
> 
> 
> 
>