3 Replies Latest reply on Nov 5, 2008 4:03 AM by ilya_shaikovsky

    sortBy and rich:column containing h:selectOneMenu

    john_hedden

      selectOneMenu is losing index/position when sorting by another column. its almost like its not sorting like the rest of the table. same thing happens when filtering as well. any suggestions?

      <a:form id="serverInventoryForm">
      
       <a:outputPanel id="messagePanel" ajaxRendered="true">
       <h:messages styleClass="message" globalOnly="true" />
       <rich:spacer height="10"/>
       </a:outputPanel>
      
       <a:outputPanel id="serverInventoryPanel">
       <h:panelGrid columns="1" width="100%" rendered="#{servers.rowCount == 0}">
       <h:outputText value="No Servers" styleClass="message" />
       <rich:spacer height="10"/>
       </h:panelGrid>
      
       <rich:datascroller align="center" for="serverInventory" maxPages="20" rendered="#{servers.rowCount > 0}" />
       <rich:spacer height="20" />
       <rich:dataTable onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
       onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"
       value="#{servers}" var="server" id="serverInventory" rows="40"
       rendered="#{servers.rowCount > 0}" width="100%">
       <f:facet name="header">Server Inventory</f:facet>
       <rich:column sortBy="#{server.environment.order.orderNumber}"
       filterBy="#{server.environment.order.orderNumber}" filterEvent="onkeyup">
       <f:facet name="header">Order #</f:facet>
       <h:outputText value="#{server.environment.order.orderNumber}" />
       </rich:column>
       <rich:column>
       <f:facet name="header">Infra. Mgmt.</f:facet>
       <h:outputText id="infraMgmtText" value="#{server.infraManagement.displayName}"
       rendered="#{server.purchaseOrder.getPoNumber() != null ? 'true' : 'false'}">
       </h:outputText>
       <h:selectOneMenu id="infraMgmt" value="#{server.infraManagement}"
       rendered="#{server.purchaseOrder.getPoNumber() == null ? 'true' : 'false'}" required="true">
       <s:convertEnum />
       <s:selectItems value="#{server.infraManagements}" var="enumVar" label="#{enumVar.displayName}"
       noSelectionLabel="Please select.." hideNoSelectionLabel="true" />
       <a:support event="onchange" action="#{serverList.updateServer()}" ajaxSingle="true"
       reRender="serverInventoryPanel, messagePanel"/>
       </h:selectOneMenu>
       </rich:column>
       <rich:column sortBy="#{server.purchaseOrder.poNumber}"
       filterBy="#{server.purchaseOrder.poNumber}" filterEvent="onkeyup">
       <f:facet name="header">P.O. #</f:facet>
       <h:outputText value="#{server.purchaseOrder.poNumber}" />
       </rich:column>
       </rich:dataTable>
       <rich:spacer height="20" />
       <rich:datascroller align="center" for="serverInventory" maxPages="20" rendered="#{servers.rowCount > 0}"/>
       </a:outputPanel>
      
       </a:form>


        • 1. Re: sortBy and rich:column containing h:selectOneMenu
          ilya_shaikovsky

          please describe your environment.. and sorry but i'm not sure that understand this right


          is losing index/position when sorting by another column.


          could you please add more detailed case eexplanation?

          • 2. Re: sortBy and rich:column containing h:selectOneMenu
            john_hedden

            i'll attempt to be more specific. when i access the page for the first time i get a datatable with a few sortable columns, lets call them column A, column B, and column C. In column C i have a h:selectOneMenu which uses seam to convert enums and renders a drop down list of a few select items. so for instance row 1 will have "example a" as its value for drop down in column C. when i sort on column A, row 1 no longer has "example a" as its drop down value but it may be "example b" or "example c". does that make sense? is it possible to have the selectOneMenu in the rich:column? if so, should i be able to sort on another column and have its (selectOneMenu) value retained since it is coming from model?

            • 3. Re: sortBy and rich:column containing h:selectOneMenu
              ilya_shaikovsky

              It looks at least very strange.. :) sorting isn't influence model values for other columns at all. could you please made a simple war example (with java sources) for our investigation?

              Thanks for your patience!