• Pager Save State and startKeys

    By Steve Smillie 1 decade ago

    I am looking for ideas on how to restore the startKeys when using the Pager Save State Control.

    Currently I set the startKeys on the view panel to a viewScope variable.  And if the user wishes to move down a large view can type into a edit box that then sets that viewScope.  That works great when the user is on the page with the view, but after returning to that page using the pager Save State, obvoiusly the viewScope is no longer populated.

    If I uses a sessionScope then the startKeys is still correct when returning to the view page but that is also used when switching to a totally different page with a view .

    It is like I need to save and restore the viewScope variable with the Page Save State control.
    Any way to do that?
    Or should I use a different sessionScope for each view page?

    • The state can be managed by a bean

      By Philippe Riand 1 decade ago

      In fact, the PagerSaveState assign a managed bean (viewStateBean) to the data iterator, using its binding property. And then this bean methods are triggered  when the state needs to be saved/restored. If you look at  the old examples of the extlib, before the pager was avail, this is how the demo database was doing it.. Then your bean can store whatever it needs from the view.

      It is an advanced use case, but if you're willing to implement it, please blog the solution :-)

      • Sounds like a good solution.

        By Steve Smillie 1 decade ago

        Thanks for the response.  The managed bean approach sounds like the way to go.

         

        Perhaps that is something I will look into in the future.  I just don't have the time to get into that advanced of a solution at this point.  If anyone does look into this type of solution, please share!