4 Replies Latest reply on Feb 9, 2011 5:09 AM by Joao Cunha

    Reset sort order

    Joao Cunha Newbie

      Hello,

       

      I'm developing a WebApplication using Richfaces 3.3 final and JBoss Seam 2.x.

      Currently I'm facing 2 problems that I can't resolve.

      We are using modalPanels with extendedDataTable to provide lov concept, but everytime we click on the lov again the sort order has not been reset.

       

      > Is it possible to reset it?

      > After sorting can we force the datatable to go to first page?

       

      As a side note we are trying to avoid going to server side sorting/pagination in these lov. We are already doing it in other cases.

      Thanks in advance.

        • 1. Reset sort order
          Rocky S Master

          Hi Joao,

           

          >Yes, it is possible to reset it.

          >After sorting the datatable can go to the first page.

          • 2. Reset sort order
            Joao Cunha Newbie

            Hello,

             

            thank for you reply.

            Could you please point me in the right direction?

            Thanks

            • 3. Re: Reset sort order
              Rocky S Master

              In order to reset sort order, You need to blank out the page parameters.

               

              Example-

              <s:button id="reset" value="Reset" styleClass="tbtn">

                                          <f:param name="catgryDesc" />

              </s:button>

               

               

              After sorting to go first page,

              You need to set the firstResult value to blank or null or 0, this will cause the result set to move to first page. firstResult is property of Query Interface.

              • 4. Re: Reset sort order
                Joao Cunha Newbie

                Hi,

                 

                I don't think that solution can help me because in this case we are using in memory sorting sorting/pagination, RichFaces default. So as I see it we can't intercept sorting events ..

                 

                Maybe I'm wrong ..

                 

                ManagedBean:

                 

                    @DataModel

                    private List<MdLocation> mdLocationList;

                 

                xhtml file:

                 

                <a:commandLink id="clDestinationLov" 

                                          tabindex="-1" eventsQueue="tsfQueue"

                                          actionListener="#{tsfDetailBean.locationActionListener}"

                                          oncomplete="Richfaces.showModalPanel('mpDestinat');"

                 

                                          reRender="opDestination, opDest" limitToList="true" >

                 

                           <h:graphicImage value="#{app.lovIcon}"/>

                </a:commandLink>

                 

                 

                <rich:modalPanel id="mpDestinat" width="530" height="550" rendered="#{!tsfDetailBean.onLoad}">

                 

                                <f:facet name="header">

                                    <h:panelGroup>

                                        <h:outputText value="#{lang['tsfDetails.destinationLov.title']}"/>

                                    </h:panelGroup>

                                </f:facet>

                                <f:facet name="controls">

                                    <h:panelGroup>

                                        <h:graphicImage value="#{app.closeIcon}" styleClass="hidelink" id="giHideSupplierLov"/>

                                        <rich:componentControl for="mpDestinat" attachTo="giHideSupplierLov" operation="hide"

                                                                   event="onclick"/>

                                    </h:panelGroup>

                                </f:facet>

                 

                                <a:form id="fSupplier" styleClass="center-align">

                                    <a:outputPanel id="opDestination">

                                    <h:panelGrid columns="1">

                                        <h:panelGroup>

                                            <h:outputText value="#{lang['global.description']}"/>

                                            <rich:spacer width="10"/>

                                            <h:inputText id="itDesc" value="#{mdLocationAction.searchParam}" onkeypress="return event.keyCode!=13"/>

                                            <rich:spacer width="10"/>

                 

                                            <a:commandButton id="cbLocationSearch" 

                                                             value="#{lang['global.search']}"

                                                             reRender="tbLocation, dsLocation" limitToList="true"

                                                             eventsQueue="tsfQueue"

                                                             action="#{mdLocationAction.findMdLocationBySearchParam}">

                                            </a:commandButton>

                                        </h:panelGroup>

                 

                                        <rich:separator/>

                 

                 

                                         <rich:extendedDataTable id="tbLocation"

                                                value="#{mdLocationList}"

                                                var="_locationVar"

                                                width="500px" height="400px"

                                                rows="16" noDataLabel="#{lang['global.table.noRows']}"

                                                sortMode="single"

                                                selectionMode="single">

                 

                 

                ........

                 

                findMdLocationBySearchParam is a method that delegate search to a Manager/service object implemented with spring/hibernate to fetch. But like I said before it only querys data the fist time. After that all sorting occurs in memory ..

                 

                Hope someone can help ..

                 

                Thanks in advance