XPages Data Views – Part 6: Pager Save State Control

The Pager Save State control is another great feature available to work with a Data View. It allows you to restore the expand/collapse state of each element in the view to the state the user last left it.

Data View Series

By default, any time you open a Data View, it will open with all categories and details sections collapsed, regardless of any changes that the user made to the state previously. With the Pager Save State control, it’s easy to maintain the previous state and restore it when the user returns to the view.

Adding the Control

1. Drag and drop a Pager Save State control onto the page from the the Extension Library section of the controls palette.

DataView6_A

It looks like a gold 3.5″ floppy disk icon in Domino Designer.

DataView6_B

2. Set the for property of the control to the id of the Data View.

Using the Control

3. To make use of the control, you need to execute a single line of SSJS that will make use of the Pager Save State Bean that the control provides and restores the view state.

viewStateBean.restoreState = true;

Just call this before re-opening the Data View and it will restore the state as it was left. If the user has used the Pager Add Rows control to add more rows to the view, it will also restore the same number of rows that were last displayed.

In addition to working if you’re using SSJS to return to the view, you can make it work if you’re using Simple Actions as well. For example, if you’re using an Open Page Simple Action to return to the view, you can add an Execute Script simple action before it that contains that one line of code.

Up Next

In the next post, we’ll take a look at how to take your Data View UI to the next level by customizing the Summary section.

Advertisements

3 responses to “XPages Data Views – Part 6: Pager Save State Control”

  1. Jason says :

    Hi,

    Does pager save state support the dynamic content. I have dynamic content with form and view iniside and pager save state custom controls.The default for dynamic content is view. Switching view and the form has no problem.

    The problem is when I return to the view from the form, it does not restore to the previous view state.

    I have asked this question on the other forums but nobody reply. Can you clarify pls.

    • Brad Balassaitis says :

      I have not tried it, so I can’t say for sure. However, I know that when I have tested it, it’s always been in a case where I was returning to a different page. I don’t know whether the dynamic content makes it not work or whether it needs a complete reload in order to work, rather than a partial refresh.

      Try executing a full refresh on the page after the executing the line of SSJS to restore the state and changing the dynamic content to see if that does the job.

    • Gary says :

      I have the same issue. Did you have any luck resolving this?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: