14 Replies Latest reply on Aug 18, 2008 2:15 PM by shadowcreeper

    scrollableDataTable Sorting not working

    Mark French Newbie

      Hi,

      I have a requirement to enable column sorting on a scrollableDataTable which I understand works out of the box. The following is the code snippet I using but clicking on the header fails to sort my results. Any ideas or do I have to implement my own sorter?

      <rich:scrollableDataTable id="workOrderResults" value="#{searchWorkOrders.workOrders}"
       hideWhenScrolling="true"
       selection="#{searchWorkOrders.dataTableBinding.selection}" binding="#{searchWorkOrders.dataTableBinding.table}"
       height="200px" width="95%" styleClass="resultsTable" sortMode="single"
       frozenColCount="1" var="order" rows="15">
      <rich:column sortBy="#{order.workOrderNo}">
       <f:facet name="header">
       <h:outputText value="#{labels.workOrder}"/>
       </f:facet>
       <h:outputText value="#{order.workOrderNo}"/>
      </rich:column>
      ......
      


      Any help would be greately appreciated.

      Cheers

      Mark

        • 1. Re: scrollableDataTable Sorting not working
          Dongyao Zhao Novice

          I have the same problem. Anybody can resolve the problem? thanks in advanced

          • 2. Re: scrollableDataTable Sorting not working
            Mark Rich Newbie

            I hv this problem too. But I found it's okay in demo site.

            my dev env:
            eclipse 3.3.2
            jdk 1.5
            tomcat 6.0
            jsf 1.2 RI

            • 3. Re: scrollableDataTable Sorting not working
              Daniel Young Novice

              Try using "sortExpression=" rather than "sortBy=".

              For some reason in our version, only sortExpression works on scrollabledatatable and only sortBy works on datatable.

              go figure!

              • 4. Re: scrollableDataTable Sorting not working
                brian young Newbie

                 

                Try using "sortExpression=" rather than "sortBy=".


                Well, let me add a "me too" to this list of people having sorting difficulties with scrollabledatatable.

                Unfortunately using sortExpression makes no diff. for me. If you look at the demo site though, the examples all use component binding. So, something is probably happening server side. A value binding version of the table probably isn't sortable?

                I wish the docs were more clear on this, the sorting verbiage is rather vague in regard to this component. In general scrollabledatatable seems to be the black sheep of the library... its appearance isn't as nice as the datatable either. But, for me it is a valuable part of the UI, so I have to make it work.

                • 5. Re: scrollableDataTable Sorting not working
                  Valery Tcherepanov Newbie

                  I've discovered what makes columns sortable. Notice how a column is defined in the demo.

                  <rich:column id="make">
                   <f:facet name="header"><h:outputText styleClass="headerText" value="Make" /></f:facet>
                   <h:outputText value="#{category.make}" />
                   </rich:column>

                  id attribute (id="make") matches second part of value expression (value="#{category.make}") .
                  If you omit or change id attribute the column wouldn't be sortable anymore. Looks like sorting procedure by some reason uses id instead of value expression.

                  • 7. Re: scrollableDataTable Sorting not working
                    vlad.kamensky Newbie

                     

                    "ValeryTcherepanov" wrote:

                    If you omit or change id attribute the column wouldn't be sortable anymore. Looks like sorting procedure by some reason uses id instead of value expression.


                    Not to mention, that "sortBy" attribute is completely ignored by "scrollableDataTable".

                    • 8. Re: scrollableDataTable Sorting not working
                      Daniel Young Novice


                      Stay away from scrollableDataTable, it's the black sheep of the component family!

                      "vlad.kamensky" wrote:
                      "ValeryTcherepanov" wrote:

                      If you omit or change id attribute the column wouldn't be sortable anymore. Looks like sorting procedure by some reason uses id instead of value expression.


                      Not to mention, that "sortBy" attribute is completely ignored by "scrollableDataTable".


                      • 9. Re: scrollableDataTable Sorting not working
                        vlad.kamensky Newbie

                         

                        "jazir1979" wrote:

                        Stay away from scrollableDataTable, it's the black sheep of the component family!


                        Can you please be more descriptive about your point ? Problem is that we really I a horizontal scrolling support for a table and thus, I have to go with "scrollableDataTable". Not to mention, that it is the only table that support selection.



                        • 10. Re: scrollableDataTable Sorting not working
                          Daniel Young Novice

                          Well, in our application having these tables on the page caused rendering and ajax re-rendering to be exteremely slow and error prone -- including internal IE errors, exteremely ugly shifting around the page while re-rendering, headers disappearing upon re-rendering, etc.

                          There was also very different behaviour across browsers.

                          Things got particularly bad when we tried to do ajax scrolling over large data sets, because the row selection gets out of synch. Things got even worse when we combined this with in-table editing.

                          The functionality of the component is great, but we found by doing our own row selection in rich:dataTable combined with the rich:datascroller, all of our problems went away.

                          Perhaps this component will work well for you on your pages and in your circumstances, there are alot of factors involved. But take a good look through the forums and Jira before making up your mind.

                          • 11. Re: scrollableDataTable Sorting not working
                            vlad.kamensky Newbie

                             

                            "jazir1979" wrote:


                            The functionality of the component is great, but we found by doing our own row selection in rich:dataTable combined with the rich:datascroller, all of our problems went away.


                            Thanks for your comments. You know, that I also thought about using simpler component to avoid problems with scrollableDataTable. I do understand how to make row selection in rich:dataTable and how to combine it with rich:datascroller. But still, there will be one unresolved problem. How to deal with horizontal scrolling ? The rich:datascroller can help to get rid of vertical scrolling but horizontal scrolling will still be a problem.

                            Any thoughts about that ?

                            • 12. Re: scrollableDataTable Sorting not working
                              Daniel Young Novice

                              Yes, you can get both vertical and horizontal scrolling by placing the table in a div that uses the "overflow-x" and "overflow-y" CSS properties.

                              The main feature that we miss out on now is the nice manual resizing of column widths, but the client was able to live without that one, luckily.

                              Seriously, all of our speed and stability problems have disappeared since ditching the scrollabledatatable. And our frustration and stress levels are much healthier as well!

                              • 13. Re: scrollableDataTable Sorting not working
                                vlad.kamensky Newbie

                                 

                                "jazir1979" wrote:
                                Yes, you can get both vertical and horizontal scrolling by placing the table in a div that uses the "overflow-x" and "overflow-y" CSS properties.

                                The main feature that we miss out on now is the nice manual resizing of column widths, but the client was able to live without that one, luckily.

                                Seriously, all of our speed and stability problems have disappeared since ditching the scrollabledatatable. And our frustration and stress levels are much healthier as well!


                                Thanks for info! I really appreciate your answers.

                                • 14. Re: scrollableDataTable Sorting not working
                                  shadowcreeper Apprentice

                                  But what about locking the left-most column (so that scrolling horizontally leaves it in place)?

                                  In IE you can make the column style="position: relative;", but that doesn't work for FF...