Announcement Announcement Module
Collapse
No announcement yet.
Rolling back state after back button Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rolling back state after back button

    Hi All,

    Is there a way of attaching a variable to a concrete view execution so that after clicking browser's back the variable value goes back to whatever it was at previous render?
    In my flow(SWF 2.08+Facelets), I have a view state that display search results for a string. I want to see previous search results after clicking the back button. Whatever I try, all I see is the most recent search results.
    The search action is a transition into the same state.
    I keep the search string in a Criteria object and I tried initialising it as a <var> and in the <on-start> as conversation-, flow- and view-scope variable.
    I perform the search in view's <on-entry> and also tried it within the <transition>.
    I searched the forums on back button but still struggle.

  • #2
    View-scope should work for this, but you won't be able to define this in the on-start section of your flow. View-scope is only usable within a view-state, so you'll want to place it in the on-entry section of your view-state.

    It would be a great help if you posted the relevant portion of your flow definition.

    Comment


    • #3
      Thanks InverseFalcon.
      I played more with the viewScope and I have partial success. The remaining problem is that the search box appears on every page so I have a global 'search' transition. On the first search I can't use the viewScope because I'm transiting from a different view-state. Any hints on resolving this? My flow definition:

      Code:
      <view-state id="searchItemsPage">
        <transition on="searchItem">
          <evaluate expression="itemSearchAction.findItems(searchCriteria)" 
                    result="viewScope.pageResult"/>
        </transition>
      </view-state>
      
      <global-transitions>
      <transition on="searchItem" to="searchItemsPage">
        <evaluate expression="itemSearchAction.findItems(context, searchCriteria)" 
                  result="flowScope.pageResult"/>
      </transition>
      </global-transitions>
      The search box is bound to a property in searchCriteria and search results to pageResult. I don't know how to resolve the global-transitions bit. Having pageResult in flowScope won't work as it overrides the viewScope's values. Any ideas on what could I try?

      Thanks

      Comment

      Working...
      X