5 Replies Latest reply on Oct 26, 2011 6:36 AM by mcmurdosound

    Table filtering and history

    pzelenka00

      Hi,

       

      I use JSF 1.2 and RichFaces 3.3.3. On one of my pages I use rich:dataTable with column filtering. There is also a column with h:commandLink which redirects to another page. Problem is when table filtering is active (table shows filtered rows), users clicks to the link, another page shows, user clicks browser's back button, the table is not filtered (despite the value in column filtering field is shown)

      Anyone got idea why?

       

      Thank

       

      Pavel

        • 1. Re: Table filtering and history
          pzelenka00

          I noticed the same behavior in the live demo http://livedemo.exadel.com/richfaces-demo/richfaces/filteringFeature.jsf?tab=ex-usage&cid=26569

          When you filter by timezone (for example to -8), click any link on the left pane (foe example Column) then click browser's back button. Now you see unfiltered table even though -8 is shown in the filter field.

          • 2. Re: Table filtering and history
            mcmurdosound

            you have to build your own filter mapping. Maybe session scoped or conversational to store entered filtervalues (Map<String, String>) for each column.

             

             

            http://livedemo.exadel.com/richfaces-demo/richfaces/filteringFeature.jsf?tab=ex-usage

             

            I woundn't use the browsers back button ;-)

            • 3. Re: Table filtering and history
              pzelenka00

              Thanks for reply, but I already have filter values stored in session bean. The problem is that rich:dataTable needs to be rerendered after retruning from another page. Anyone know how?

              • 4. Re: Table filtering and history
                pzelenka00

                I think I found a sollution. I created a jsFunction which only rerenders a table. On the page I simply call this function.

                 

                                   <h:form>
                                    <rich:dataTable value="#{indexBean.cityList}" var="city" id="table">
                                        <f:facet name="header">
                                            <rich:columnGroup>
                                                <rich:column>
                                                    <h:outputText value="City"/>
                                                </rich:column>
                                            </rich:columnGroup>
                                        </f:facet>       
                                        <rich:column filterBy="#{city}" filterEvent="onkeyup" filterValue="#{richFacesBean.filterValue}">
                                            <h:outputText value="#{city}"/>
                                        </rich:column>
                                    </rich:dataTable>
                                    <a4j:jsFunction name="tableReload" reRender="table" />
                                </h:form>
                                <script type="text/javascript">
                                   tableReload();
                                </script>
                
                

                 

                 

                • 5. Re: Table filtering and history
                  mcmurdosound

                  your also could try this approach: http://seamframework.org/122900.lace