<context-param>
        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
        <param-value>true</param-value>
        <description>
            If true, a javascript function will be rendered that is
able to restore the
            former vertical scroll on every request. Convenient
feature if you have pages
            with long lists and you do not want the browser page to
always jump to the top
            if you trigger a link or button action that stays on the same page.
            Default: "false"
        </description>
    </context-param>

I don't understand how it works, but if you know javascript, you
should be able to view source on your generated page and figure it
out.   It looks like it determines which UICommand to scroll back to
on the next response rendered using
"document.forms['form'].elements['autoScroll'].value=getScrolling()"
in an onclick.

So you'd just need to figure out how to set autoScroll to your
components equivalent "getScrolling()" value.


On 10/26/05, Simon Kitching <[EMAIL PROTECTED]> wrote:
> > Having implemented a valueChangeListener, using an onclick="submit()"
> >
> > With the code resulting in
> >
> >
> >
> >             //          Now update GUI
> >
> >             FacesContext.getCurrentInstance().renderResponse();
> >
> >
> >
> > My screen is redrawn – it has quite a few components displayed and so
> > the User sees the top of the screen being displayed
> >
> > Is there any way to 'mark' which component should be scrolled into view
> > when the redraw occurs
> >
> >
>
> As far as I know there isn't currently any way to force a particular
> component to be scrolled into view after a round-trip to the server.
>
> This might make a nice tomahawk component:
>    <t:scrollToView>
>      <!-- example of a component to scroll to after refresh -->
>      <h:inputText .../>
>    </t:scrollToView>
> or
>    <t:scrollToView componentId="id_of_component_to_scroll_to"/>
>
> There are a number of different possible implementations in javascript.
>  From a brief look around I see:
>    obj.scrollIntoView(true) --> IE only?
>    obj.scrollTop="10px" --> ??
>
> However in most cases you want to set focus on this component as well as
> scrolling it into view, yes? And I suspect that if you set focus on a
> component the browser will automatically scroll it into view if it isn't
> already. So maybe a custom component like this would be more useful:
>
>    <t:focus componentId="id_of_component_to_focus"/>
>
> This should also be mush easier to implement in a portable manner...
>
>
> Regards,
>
> Simon
>

Reply via email to