-
Type:
Bug
-
Status: Closed (View Workflow)
-
Priority:
Minor
-
Resolution: Done
-
Affects Version/s: 4.0.0.Final
-
Fix Version/s: 4.5.0.Beta2
-
Component/s: component-tables
-
Labels:
-
Sprint:4.5.0.Beta2 - Sprint 3
When <rich:collapsibleSubTable /> s are nested, the following error occurs:
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.
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.
|
FixedCollapsibleSubTableRenderer.java |
|
|
/**
|
* 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);
|
}
|
}
|
|
|
}
|
|
This renderer needs to be registered in faces-config.xml:
<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>
|