4 Replies Latest reply on Jun 23, 2009 12:08 PM by israel.bgf

    rich:subTable - Possible bug.

    israel.bgf

      Just to confirm before i post it in JIRA. Does the rich:subtable can be rendered? Cause my testing say that it cant (Using 3.3.1 version). Example:

      <rich:dataTable value="#{test.list}" var="person">
       <rich:column>
       <f:facet name="header">
       Name
       </f:facet>
       #{person.name}
       </rich:column>
       <rich:column>
       <f:facet name="header">
       Age
       </f:facet>
       #{person.age}
       </rich:column>
       <rich:column>
       <f:facet name="header">
       Action
       </f:facet>
       <a4j:form>
       <a4j:commandButton value="Show Detail" action="#{test.change}" reRender="detail"/>
       </a4j:form>
       </rich:column>
       <rich:column breakBefore="true" id="detail" colspan="3">
       #{test.rendered ? 'Should be rendered' : 'Should not be rendered'}
       <rich:subTable value="#{test.detailList}" var="detail" rendered="#{test.rendered}">
       <rich:column colspan="3">
       <f:facet name="header">
       Detail
       </f:facet>
       #{detail}
       </rich:column>
       </rich:subTable>
       </rich:column>
       </rich:dataTable>


      The showDetail button rerender the column that have the subtable but it dont get rendered (my EL message get rerendered), but full refresh on the page really shows the subtable. Changing the rich:subTable for a rich:dataTable make it works with the reRender. Is that a bug so?

        • 1. Re: rich:subTable - Possible bug.
          alibsd

          Hi Israel

          The rendered attribute of rich:subTable works fine, I've used it
          recently in one of my projects. One thing that seems strange to me,
          is that you've placed your subTable into a column, I can't understand
          why you did that. Are you sure that there is no other way to use your
          subTable?

          I think that the code below has the same effect, sorry if it dosn't:

          <rich:dataTable value="#{test.list}" var="person">
           <rich:column>
           <f:facet name="header">
           Name
           </f:facet>
           #{person.name}
           </rich:column>
          
           <rich:column>
           <f:facet name="header">
           Age
           </f:facet>
           #{person.age}
           </rich:column>
          
           <rich:column>
           <f:facet name="header">
           Action
           </f:facet>
           <a4j:form>
           <a4j:commandButton value="Show Detail" action="#{test.change}" reRender="detail"/>
           </a4j:form>
           </rich:column>
          
           <rich:subTable value="#{test.detailList}" var="detail" rendered="#{test.rendered}">
           <rich:column colspan="3">
           <f:facet name="header">
           Detail
           </f:facet>
           #{detail}
           </rich:column>
           </rich:subTable>
          </rich:dataTable>
          


          • 2. Re: rich:subTable - Possible bug.
            israel.bgf

            hmm, thks for the reply alibsd. I'm using the subTable inside a column because the richfaceslivedemo use it like this, and without it if I use a a4j:outputPanel to reRender it, it stops working at all even with full refreshes.

            About your example code, to work i would need to put an a4j:outputPanel around the subtable (we cant trigger a reRender to components with the rendered attribute), but i got the problem that i described before.

            What version of richfaces do you use it? Could you paste your code here?

            Thks

            • 3. Re: rich:subTable - Possible bug.
              alibsd

              I checked livedemo, subTable has not been embedded into a column,
              take a look again:


              http://livedemo.exadel.com/richfaces-demo/richfaces/dataTable.jsf

              Another thing that you should know is that subTables could not be
              reRendered, and the whole table must be reRendered, see this:
              http://www.jboss.org/index.html?module=bb&op=viewtopic&t=152365

              I use RichFaces 3.3.1.

              I wanted to created some kind of master/detail presentation and
              my code is:

              <!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:c="http://java.sun.com/jsp/jstl/core"
               xmlns:h="http://java.sun.com/jsf/html"
               xmlns:f="http://java.sun.com/jsf/core"
               xmlns:ui="http://java.sun.com/jsf/facelets"
               xmlns:rich="http://richfaces.org/rich"
               xmlns:a4j="http://richfaces.org/a4j">
               <rich:dragIndicator id="indicator" />
               <a4j:loadStyle
               src="#{view.locale == 'fa' ? '/sg_rtl.css' : '/sg_ltr.css'}" />
               <a4j:region id="gridReg">
               <rich:dataTable id="grid" rows="#{gridBean.pageSize}"
               sortMode="#{empty sortMode ? 'single' : sortMode}"
               value="#{gridBean.rows}" var="row" width="#{width}">
               <f:facet name="header">
               <rich:columnGroup>
               <rich:column colspan="#{gridBean.numOfCols / 2}"
               styleClass="leftAligned">
               <a4j:outputPanel layout="block">
               <rich:dropSupport id="dropSup" acceptedTypes="col"
               dropListener="#{gridBean.handleGrouping}" reRender="grid" />
               <ui:insert name="header">
               <h:outputText value="#{gridBean.title}" />
               </ui:insert>
               </a4j:outputPanel>
               </rich:column>
              
               <rich:column colspan="#{gridBean.numOfCols / 2}"
               styleClass="rightAligned">
               <a4j:outputPanel layout="block">
               <rich:dropSupport id="dropSup2" acceptedTypes="col"
               dropListener="#{gridBean.handleGrouping}" reRender="grid" />
               <a4j:commandButton id="rstSort" action="#{gridBean.resetSort}"
               ajaxSingle="true" reRender="grid"
               value="#{gridBundle.resetSort}" />
               </a4j:outputPanel>
               </rich:column>
              
               <rich:column breakBefore="true" colspan="#{gridBean.numOfCols}"
               rendered="#{gridBean.inGroupingState}" styleClass="leftAligned">
               <a4j:commandButton id="ungrp" action="#{gridBean.unGroup}"
               ajaxSingle="true" reRender="grid"
               value="#{gridBean.groupedColName}" />
               </rich:column>
               </rich:columnGroup>
               </f:facet>
              
               <rich:column id="grpName" colspan="#{gridBean.numOfCols / 2}"
               rendered="#{gridBean.inGroupingState}"
               style="background-color: #BBBBBB" styleClass="leftAligned">
               <a4j:commandLink id="openGrp" actionListener="#{row.toggleCollapse}"
               reRender="grid" value="#{row.title} (#{row.totalCount})" />
               </rich:column>
               <rich:column id="grpCnt" colspan="#{gridBean.numOfCols / 2}"
               rendered="#{gridBean.inGroupingState}"
               style="background-color: #BBBBBB" styleClass="rightAligned">
               <a4j:commandLink actionListener="#{row.expand}"
               disabled="#{row.collapsed or (not (row.toIndex lt row.totalCount))}"
               rendered="#{not row.collapsed}" reRender="grid"
               value="#{row.toIndex} #{gridBundle.of} #{row.totalCount}" />
               </rich:column>
              
               <rich:subTable id="sub" rendered="#{gridBean.inGroupingState}"
               sortMode="#{empty sortMode ? 'multi' : sortMode}"
               value="#{row.members}" var="member">
               <rich:columns index="index" id="column#{index}"
               selfSorted="#{col.sortable}" sortBy="#{col.title}"
               sortOrder="#{gridBean.sortOrders[col.title]}"
               value="#{gridBean.cols}" var="col">
               <f:facet name="header">
               <ui:insert name="subTabColsHeader">
               <h:outputText value="#{col.title}" />
               </ui:insert>
               </f:facet>
               <ui:insert name="subTabColsBody">
               <h:outputText value="#{member[col.title]}" />
               </ui:insert>
               </rich:columns>
               </rich:subTable>
               </rich:dataTable>
               </a4j:region>
              </ui:component>
              




              • 4. Re: rich:subTable - Possible bug.
                israel.bgf

                Now i get it. :)

                So the subTable cant be rerendered... well that's answer all my questions.

                Thks again alibsd.