0 Replies Latest reply on Nov 8, 2011 10:42 AM by Fabio Oliveira

    Using custom facelet component inside a datatable

    Fabio Oliveira Newbie

      Greetings,

       

      I am trying to do something like the code bellow, but I don't know why the custom facelet component isn't been rendered inside the datatable.

      Can someone please help me?

       

      Regards,

       

      Fabio

       

      Ps: I'm using Richfaces 3.3.3.

       

      <!-- Facelet custom component rowExpansion.xhtml -->
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:component xmlns="http://www.w3.org/1999/xhtml"
            xmlns:h="http://java.sun.com/jsf/html"
            xmlns:f="http://java.sun.com/jsf/core"
            xmlns:rich="http://richfaces.ajax4jsf.org/rich"                
            xmlns:ui="http://java.sun.com/jsf/facelets"
            xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
      
                <rich:columnGroup>
                   <rich:column style="display: none; border-bottom:1px solid #666; background: #fff;">
                        <ui:insert />
                   </rich:column> 
                </rich:columnGroup>
      
      </ui:component>
      

       

      <!-- myTagLib.taglib.xml -->
      ...
      <tag>
                <tag-name>rowExpansion</tag-name>
                <source>components/dataTable/rowExpansion.xhtml</source>
      </tag> 
      

       

       

      <!-- XHTML -->
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:rich="http://richfaces.ajax4jsf.org/rich"
                xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
                xmlns:my="http://myTagLib.com/myTagLib">
      
      
                <rich:dataTable var="user" value="#{userMB.users}" id="dtb" rowClasses="odd-row, even-row">
      
                          <rich:column>
                                    <f:facet name="header">
                                              <h:outputText value="Details" />
                                    </f:facet>
                                    <a4j:commandLink oncomplete="expandDetails(this)" styleClass="expand"> 
                          </rich:column> 
      
                          <rich:column>
                                    <f:facet name="header">
                                              <h:outputText value="Id" />
                                    </f:facet>
                                    <h:outputText value="#{user.id}" />
                          </rich:column>
      
                          <rich:column>
                                    <f:facet name="header">
                                              <h:outputText value="name" />
                                    </f:facet>
                                    <h:outputText value="#{user.name}" />
                          </rich:column>
      
                          <!-- Custom Facelet Component -->
                          <!-- Should render the columnGroup, the column and the panel inside -->
                          <my:rowExpansion>
                                    <rich:panel id="details">
                                         <h:outputText value="#{user.email}" />
                                    </rich:panel>
                          </my:rowExpansion>
      
                </rich:dataTable>
      
      </html>