ScrollTo a Component After Ajax Update

For long pages that scroll, ajax updates might be confusing to the users as the updated part may not be visible in viewport. To get the user’s attention, it would be nice to scroll to the updated component. PrimeFaces 3.2 provides a handy utility to implement this;

RequestContext.getCurrentInstance().scrollTo('form:panel');

When the panel component is updated, PrimeFaces will scroll to the component with a smooth animation.

Check out the live demo at PrimeFaces Labs!

This entry was posted in PrimeFaces. Bookmark the permalink.

2 thoughts on “ScrollTo a Component After Ajax Update

  1. Actually this is a feature with which I have been struggling since the early primefaces 1 (in paginator). Even youtube has this problem when I navigate through the comments.

    Personally, I am very grateful for having this included by default =).

    Thanks!!!!!