[richfaces-issues] [JBoss JIRA] Commented: (RF-11090) rich:collapsibleSubTable cannot be nested

Daniel Diehl (JIRA) jira-events at lists.jboss.org
Wed Jul 20 16:13:23 EDT 2011


    [ https://issues.jboss.org/browse/RF-11090?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12615521#comment-12615521 ] 

Daniel Diehl commented on RF-11090:
-----------------------------------

I still facing problems even using this workaround.
On the rich:collapsibleSubTableToggler, the first one one the dataTable works fine. but the second one on the first rich:collapsibleSubTable that should open nested rich:collapsibleSubTable doesn't work. 

Does it work for you?

My structure is something like this:
{code:xml} 
 <rich:dataTable id="table1">
     <rich:column> 
        ...
        <rich:collapsibleSubTableToggler for="subTable1"/>
        ...
     </rich:column>
     <rich:collapsibleSubTable id="subTable1" expandMode="ajax">
        ...
        <rich:column> 
           ...
           <rich:collapsibleSubTableToggler for="subTable2"/>
           ...
        </rich:column>
        ...
        <rich:collapsibleSubTable id="subTable2" expandMode="ajax">
           ...
        </rich:collapsibleSubTable>
     </rich:collapsibleSubTable>
 </rich:dataTable>
{code} 

> rich:collapsibleSubTable cannot be nested
> -----------------------------------------
>
>                 Key: RF-11090
>                 URL: https://issues.jboss.org/browse/RF-11090
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-tables
>    Affects Versions: 4.0.0.Final
>            Reporter: Val Blant
>             Fix For: 4.1.0.Final
>
>
> When _<rich:collapsibleSubTable />_ s are nested, the following error occurs:
> {quote}
> This page contains the following errors:
> error on line 202 at column 74: Opening and ending tag mismatch: tbody line 0 and tr
> Below is a rendering of the page up to the first error.
> {quote}
> The page is rendered up to the nested _<rich:collapsibleSubTable />_.
> This error happens b/c nested sub tables render an extra _</tr>_ element after the nested subtable row.
> I was able to work around the problem by making a small tweak to _CollapsibleSubTableRenderer_. The lines I added or changes are marked with *"// fix line"* comment.
> {code:title=FixedCollapsibleSubTableRenderer.java|borderStyle=solid}
> /**
>  * Allows nested subTables to be rendered properly
>  */
> @ResourceDependencies({
>     @ResourceDependency(name = "jquery.js"),
>     @ResourceDependency(name = "richfaces.js"),
>     @ResourceDependency(library="org.richfaces", name = "collapsible-subtable.ecss"),
>     @ResourceDependency(library="org.richfaces", name = "collapsible-subtable.js")
> })
> public class FixedCollapsibleSubTableRenderer extends CollapsibleSubTableRenderer {
> 	
> 	@Override
> 	public void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase holder) throws IOException {
>         RowHolder rowHolder = (RowHolder)holder;
>         Row row = rowHolder.getRow();
>         putRowStylesIntoContext(facesContext, rowHolder);    
>         rowHolder.setRowStart(true);
>         Iterator<UIComponent> components = row.columns();
>         if (rowHolder.isUpdatePartial()) {
>             partialStart(facesContext,((AbstractCollapsibleSubTable) row).getRelativeClientId(facesContext) + ":b");
>         }
>         
>         int columnNumber = 0;
>         boolean isSubtable = false; // fix line
>         while (components.hasNext()) {
>             UIComponent component = components.next();
>             if(component.isRendered()) {
>                 if(component instanceof UIColumn ) {
>                     component.getAttributes().put(COLUMN_CLASS, getColumnClass(rowHolder, columnNumber));
>                     encodeColumn(facesContext, writer, (UIColumn)component , rowHolder);
>                     columnNumber++;
>                 } else if (component instanceof AbstractCollapsibleSubTable) {
>                     if(component.isRendered()) {
>                     	isSubtable = true; // fix line
>                         encodeRowEnd(writer);
>                     }
>                     
>                     if ( ((AbstractCollapsibleSubTable) component).isExpanded() ) {
> 	                    component.encodeAll(facesContext);
>                     }
>                     rowHolder.setRowStart(true);
>                 }
>             }    
>         }
>         if ( !isSubtable) encodeRowEnd(writer); // fix line
>         if (rowHolder.isUpdatePartial()) {
>             partialEnd(facesContext);
>         }
> 	}
> }
> {code}
> This renderer needs to be registered in _faces-config.xml_:
> {code}
> <render-kit>
>    <renderer>
>        <component-family>org.richfaces.Data</component-family>
>        <renderer-type>org.richfaces.CollapsibleSubTableRenderer</renderer-type>
>        <renderer-class>bla.FixedCollapsibleSubTableRenderer</renderer-class>
>    </renderer>
> </render-kit>
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the richfaces-issues mailing list