7 Replies Latest reply on Feb 12, 2012 3:13 PM by rart3001_1

    Problems with ordering "Rich DataTable" (Table Sorting).

    rart3001_1


      I have a backing bean in request scope. Which has an attribute List; This contains the data on list of services that are stored in the database.

       

       

      List<Service> services;


      The display show the contents of the list, and I have an option to filter the list of these services.

       


      The problem is that when the content filter and show correctly and if I click on a column with the attribute "sortBy" this I ordered the data correctly, but it loses the filter to be applied.


      For example:

       

      When I load the first time all the data and displays:

       

       

      IdNameDateCompany
      3

      Programming Service

      10/20/2011My Company 1
      1Design Service07/05/2011My Company 1
      2

      Maintenance of Equipment

      01/01/2012Other Company

       

       

      Then for example apply a filter to show only the services you have as a company "My Company 1" it shows me the following:

       

      IdNameDateCompany
      3

      Programming Service

      10/20/2011My Company 1
      1Design Service07/05/2011My Company 1


       

      And if the column "Id" is has the attribute "sortBy" when I click it shows me the following information:

       


      IdNameDateCompany
      1

      Design Service

      07/05/2011
      My Company 1
      2

      Maintenance of Equipment


      01/01/2012
      Other Company
      3

      Programming Service

       

      10/20/2011
      My Company 1


      The data is sorted correctly, but lost the filter to be applied.


      If anyone has an idea what I'm doing wrong.



      thank you very much and sorry for my English,


        • 1. Re: Problems with ordering "Rich DataTable" (Table Sorting).
          rhanus

          if you use built-in filter and sort ability of rich:column then only check they are used with respect of their backing beans

          see showcase for rich:dataTable and examine examples for both data filtering and sorting

          • 2. Re: Problems with ordering "Rich DataTable" (Table Sorting).
            vi_mahe_ka1

            it works fine for me.

            i am using richdaces 3.3..3 and extendedDatatable

             

             

            <rich:extendedDataTable value="#{M.B.list}"

                    id="Index" var="result" height="400px" width="100%"

                    binding="#{M.B.indexTable}"

                    rows="#{M.B.resultsPerPage}"

                    headerClass="blueTableHeader" enableContextMenu="false"

                    selectionMode="single" sortMode="single"

                    rowClasses="evenRow,oddRow" selectedClass="selectedClass">

                    <rich:column sortable="true" sortBy="#{result.field1}"

                     width="15%" filterBy="#{result.field1}"

                     filterEvent="onkeyup">

                     <f:facet name="header">

                      <h:outputText value="field1" />

                     </f:facet>

                     <h:outputText value="#{result.field1}" />

                    </rich:column>

            <rich:column sortable="true" sortBy="#{result.field2}" 

                     width="15%" filterBy="#{result.field2}"

                     filterEvent="onkeyup">

                     <f:facet name="header">

                      <h:outputText value="field2" />

                     </f:facet>

                     <h:outputText value="#{result.field2}" />

                    </rich:column>

            </rich:extendedDataTable>

            • 3. Re: Problems with ordering "Rich DataTable" (Table Sorting).
              rart3001_1

              Thanks for your responses. But excuse me but I think I did not explain well.


              Les I show these screenshots for the application.


              The first time I enter the screen it shows me the data as follows. Load all the data without applying any filter.

               

              Pantallazo1.png

               

              Then I select the combo box filter and then load the data again from the databaseby applying the filter. And so the table shows.

               

              Pantallazo 2.png

               

              But when I do click on a column header to sort applied. Sort the data well, but thisremoves the filter that I had applied previously. On the data to load from the database. Y is shown in the following manner.

               

              Pantallazo3.png

               

              Now I have a question, when I apply an ordering is done a request back to thebacking bean and this parameter does not take the filter to apply before? That I cando to fix this? I'm using JSF 1.2 with RichFaces 3.3



              • 4. Re: Problems with ordering "Rich DataTable" (Table Sorting).
                rhanus

                in your backing beans you should connect filters (panel above the datatable) with the way how you load data because you obviously don't use built-in filtering table capabilities

                • 5. Re: Problems with ordering "Rich DataTable" (Table Sorting).
                  ibstmt

                  What code do you use to apply your filter?

                  • 6. Re: Problems with ordering "Rich DataTable" (Table Sorting).
                    ravi.f39

                    Hi ,

                     

                    You are loosing the filter status means it is going as a new request. so rerender the table using richfaces ajax. It may solve your problem.

                    • 7. Re: Problems with ordering "Rich DataTable" (Table Sorting).
                      rart3001_1

                      Thank you all for your responses. The problem is that I do not know how do, when i click on the column to be sorted, are sent in the new request parameters previously selected in the filters above.