1 Reply Latest reply on Oct 14, 2014 3:46 AM by Siva P

    Retaining state when going back in browser

    Max Bryan Newbie

      Hello,

       

      I have a page where a user searches for a term and results are shown in a richfaces:datascroller nested in a richfaces:dataTable. Since there are several categories, data of each category inside a richfaces:tabPanel. The structure rougly looks like this:

       

      <rich:tabPanel
                  switchType="client" selectedTab="#{search.openTabPanel}">
      
          <rich:tab name="tab-Panel1"
                    disabled="#{empty search.resultList1}">
                    <ui:include src="/inc/_results1.xhtml" />
                    <rich:spacer width="930" />
          </rich:tab>
      
      [...]
      </rich:tabPanel>
      

       

      The richfaces:datascroller looks like this:

       

      <rich:dataTable id="dataList1" [...] >
          <f:facet name="header">
              <s:div>
                 <rich:datascroller tableStyleClass="nohovercolor" for="productionList" renderIfSinglePage="false"  
                      maxPages="15" align="center"
                      page="#{search.scrollerPage1}"
                      id="prodScroller" />
               </s:div>
            </f:facet>
      
                  <ui:include src="/inc/_result1-columns.xhtml" />
      </rich:dataTable>
      
              </rich:dataTable>
      

       

      The tabPanel has the switch type client, since ajax harms the performance.

       

      The problem: The data contains links to pages with detailed information about the corresponding data. If the user clicks the back button on the details paged, the results are shown again, but always the first tab with the first page.

      What I want: If the back button is clicked, the tabPanel and the datascroller should show the previously opened tabs and pages respectivly.

       

      How do I do that?

      Thank you

        • 1. Re: Retaining state when going back in browser
          Siva P Master

          As per my understanding When You click the detailed link information new request is created.When you click the back button do the action or action Listener.You could store the previous tab values in hidden variable or in session object to retain it.

           

          Execute the query one more time so that new request is created and same vales will be retained looks like.Just make only the bean to correct scope if your requirement suits.