2 Replies Latest reply on Feb 9, 2010 12:06 AM by sumathra

    rich:column sortBy doesn’t sort properly

    sumathra

      This was the original code generated by seam-gen (2.2.0)

          <h:column>
             
      <f:facet name="header">
                 
      <ui:include src="/layout/sort.xhtml">
                     
      <ui:param name="entityList" value="#{userList}"/>
                     
      <ui:param name="propertyLabel" value="Name"/>
                     
      <ui:param name="propertyPath" value="user.name"/>
                 
      </ui:include>
             
      </f:facet>
             
      <h:outputText value="#{_user.name}"/>
         
      </h:column>

      We liked the sorting capabilities and hence we included rich:column sortBy, but sorting is incorrect (across paginated pages it lost the sorting capability, since the sorting parameters were not sent on page navigation), if we don't use /layout/sort.xhtml inside f:facet.

                      <rich:column sortBy="#{_user.name}">
                         
      <f:facet name="header">Name</f:facet>
                         
      <h:outputText value="#{_user.name}"/>
                     
      </rich:column>

      How do we get the same functionality as before using rich:column sortBy

        • 1. Re: rich:column sortBy doesn’t sort properly
          ilya_shaikovsky
          not sure that get the point correctly. Could you please check if you have scroller/sorting problems there http://livedemo.exadel.com/richfaces-demo/richfaces/sortingFeature.jsf?c=sorting&tab=usage ?
          • 2. Re: rich:column sortBy doesn’t sort properly
            sumathra

            Thanks for your reply Ilya, but we are not quite ready to use the scrolling capability yet which involves some level of code change.

             

            We actually merged th existing code to look like this, but the label currently appears as "Name with an Up arrow or Down arrow", but we would rather like to use the sortBy images which are shipped as part of richfaces. How do we achieve that?

             

                                <rich:column>

                                    <f:facet name="header">

                                        <ui:include src="/layout/sort.xhtml">

                                            <ui:param name="entityList" value="#{userList}"/>

                                            <ui:param name="propertyLabel" value="Name"/>

                                            <ui:param name="propertyPath" value="user.firstName"/>

                                        </ui:include>

                                    </f:facet>

                                    <s:link value="#{_user.fullName}" reRender="tabs" view="User.xhtml"

                                            action="#{tabHome.setTab('home', 'account')}"

                                            id="userViewId">

                                        <f:param name="userId" value="#{_user.id}"/>

                                    </s:link>

                                </rich:column>

             

            layout/sort.xhtml looks like this

             

            <ui:composition xmlns="http://www.w3.org/1999/xhtml"

                xmlns:ui="http://java.sun.com/jsf/facelets"

                xmlns:f="http://java.sun.com/jsf/core"

                xmlns:h="http://java.sun.com/jsf/html"

                xmlns:c="http://java.sun.com/jstl/core"

                xmlns:s="http://jboss.com/products/seam/taglib">

                <s:link styleClass="columnHeader" value="#{propertyLabel} #{entityList.orderColumn == propertyPath ? (entityList.orderDirection == 'desc' ? messages.down : messages.up) : ''}">

                    <f:param name="sort" value="#{propertyPath}"/>

                    <f:param name="dir" value="#{entityList.orderColumn == propertyPath and entityList.orderDirection == 'asc' ? 'desc' : 'asc'}"/>

                </s:link>

            </ui:composition>