3 Replies Latest reply on Mar 18, 2010 4:18 PM by Robert Seely

    dataTable with rich:columns not showing header facet

    Robert Seely Newbie

      Hi folks,

      I'm having a problem with a dataTable that uses a mix of a single rich:column with a dynamic set of rich:columns:  The table won't render the header facet at all, and I can't get any sort icons.  Here's the markup for it:

       

      {code}
      <rich:dataTable
           rendered="#{mddb.dataList.size>0}"
           styleClass="growthDisplayDataTable"
           value="#{mddb.dataList}" var="dataItem" id="mdt"
           rowKeyVar="idx">
           <rich:columnGroup>
                <rich:column width="30%" id="mdtKeyColumn">
                     <a:commandLink styleClass="growthDisplayDataKeyColumn"
                          action="#{mrd.setActiveNode}"
                          reRender="dataPanel,hierarchyMenu" eventsQueue="woot">
                          <h:outputText styleClass="growthDisplayDataKeyColumn"
                               value="#{idx+1}. #{dataItem.getValue()[0]}" />
                          <f:param name="activeHierarchyNodeId"
                               value="#{dataItem.getKey()}" />
                     </a:commandLink>
                </rich:column>
                <rich:columns
                     value="#{mddb.filteredDisplayColumns}"
                     var="dispCol" index="columnIdx" width="#{dispCol.columnWidth}%"
                     id="mdtColumn#{columnIdx}" sortBy="#{dataItem.getValue()[columnIdx+1]}"
                     sortOrder="#{mddb.getSortOrdering(dispCol,columnIdx)}"
                     styleClass="growthDisplayDataColumn #{dispCol.align=='R' ? 'textAlignRight' : (dispCol.align=='C' ? 'textAlignCenter' : '')}">
                     <f:facet name="header">
                          <h:outputText value=" " />
                     </f:facet>
                     <h:outputText
                          value="#{mdf.format(dispCol.formatIndex, dataItem.getValue()[columnIdx+1] * dispCol.formatMultiplier)}" />
                </rich:columns>
           </rich:columnGroup>
      </rich:dataTable>
      {code}

       

      I'm putting a space in the header facet because I don't need header text in there (I just want the sort icons), but I've tried it with both static and dynamic text, and it still doesn't work.  The data in the table is perfect, though.  What am I missing?

       

      Thanks,

      Robert

        • 1. Re: dataTable with rich:columns not showing header facet
          Robert Seely Newbie
          One extra note:  The mddb.getSortOrdering(...) method call (which returns appropriate DESCENDING, ASCENDING, and UNSORTED values from the RichFaces Ordering enum) isn't being called at all.
          • 2. Re: dataTable with rich:columns not showing header facet
            Robert Seely Newbie

            I've made the header appear by restructuring the header portion into its own columnGroup (see below), but I have no sorting icons.  I'm getting closer, but I still need an assist to get the sorting icons into there.  Thanks!

             

            {code}
            <rich:dataTable
                 rendered="#{mddb.dataList.size>0}"
                 styleClass="growthDisplayDataTable"
                 value="#{mddb.dataList}" var="dataItem" id="mdt"
                 rowKeyVar="idx">
                 <f:facet name="header">
                      <rich:columnGroup>
                           <rich:column width="30%" id="mdtKeyColumnHeader">
                                <h:outputText value="" />
                           </rich:column>
                           <rich:columns
                                value="#{mddb.filteredDisplayColumns}"
                                var="dispCol" index="columnIdx" width="#{dispCol.columnWidth}%"
                                id="mdtColumnHeader#{columnIdx}"
                                sortBy="#{dataItem.getValue()[columnIdx+1]}"
                                sortOrder="#{mddb.getSortOrdering(dispCol,columnIdx)}">
                                <f:facet name="header">
                                     <h:outputText value=" " />
                                </f:facet>
                                <h:outputText value=" " />
                           </rich:columns>
                      </rich:columnGroup>
                 </f:facet>
                 <rich:columnGroup>
                      <rich:column width="30%" id="mdtKeyColumn">
                           <f:facet name="header">
                                <h:outputText value=" " />
                           </f:facet>
                           <a:commandLink styleClass="growthDisplayDataKeyColumn"
                                action="#{mrd.setActiveNode}"
                                reRender="dataPanel,hierarchyMenu" eventsQueue="woot">
                                <h:outputText styleClass="growthDisplayDataKeyColumn"
                                     value="#{idx+1}. #{dataItem.getValue()[0]}" />
                                <f:param name="activeHierarchyNodeId"
                                     value="#{dataItem.getKey()}" />
                           </a:commandLink>
                      </rich:column>
                      <rich:columns
                           value="#{mddb.filteredDisplayColumns}"
                           var="dispCol" index="columnIdx" width="#{dispCol.columnWidth}%"
                           id="mdtColumn#{columnIdx}"
                           sortBy="#{dataItem.getValue()[columnIdx+1]}"
                           sortOrder="#{mddb.getSortOrdering(dispCol,columnIdx)}"
                           styleClass="growthDisplayDataColumn #{dispCol.align=='R' ? 'textAlignRight' : (dispCol.align=='C' ? 'textAlignCenter' : '')}">
                           <f:facet name="header">
                                <h:outputText value=" " />
                           </f:facet>
                           <h:outputText
                                value="#{mdf.format(dispCol.formatIndex, dataItem.getValue()[columnIdx+1] * dispCol.formatMultiplier)}" />
                      </rich:columns>
                 </rich:columnGroup>
            </rich:dataTable>
            {code}

             

            Message was edited by: Robert Seely ... having a hell of a time getting code to format right in here.  Any pointers are appreciated.

            • 3. Re: dataTable with rich:columns not showing header facet
              Robert Seely Newbie
              Taking out the column group fixed it:  I have a header with sort icons now.  I have another issue, but it'll have to wait for tomorrow, and for another thread.