DataGridRenderer extends AbstractRowsRenderer implements MetaComponentRenderer { public void encodeTBody(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial) throws IOException { String clientId = dataGrid.getClientId(facesContext) + ":dgb"; if (partial) { facesContext.getPartialViewContext().getPartialResponseWriter().startUpdate(clientId); } writer.startElement(HtmlConstants.TBODY_ELEMENT, dataGrid); writer.writeAttribute(HtmlConstants.ID_ATTRIBUTE, clientId, null); writer.writeAttribute(HtmlConstants.CLASS_ATTRIBUTE, "rf-dg-body", null); if (dataGrid.getRowCount() > 0) { processRows(writer, facesContext, dataGrid, null); } else { encodeNoData(writer, facesContext, dataGrid); } writer.endElement(HtmlConstants.TBODY_ELEMENT); if (partial) { facesContext.getPartialViewContext().getPartialResponseWriter().endUpdate(); } }  @Override void encodeRow(ResponseWriter writer, FacesContext facesContext, RowHolderBase rowHolder); void encodeHeader(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial); void encodeFooter(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial); void encodeCaption(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid); void encodeNoData(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid); void encodeFacet(ResponseWriter writer, FacesContext facesContext, UIComponent facet, EncodeStrategy strategy,
        AbstractDataGrid dataGrid, Object[] params); void encodeTBody(ResponseWriter writer, FacesContext facesContext, AbstractDataGrid dataGrid, boolean partial); @Override RowHolderBase createRowHolder(FacesContext context, UIComponent component, Object[] options); void encodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId); void decodeMetaComponent(FacesContext context, UIComponent component, String metaComponentId); DataVisitResult process(FacesContext facesContext, Object rowKey, Object argument); @Override void encodeFakeRow(FacesContext facesContext, RowHolderBase rowHolder);  }
@Test public final void testEncodeTBody() throws IOException { HtmlPage page = environment.getPage("/dataGridTest.jsf"); HtmlElement dataGrid = page.getElementById("dataGrid2"); assertEquals("rf-dg-body", ((HtmlElement) dataGrid.getFirstByXPath("tbody[@id='dataGrid2:dgb']")).getAttribute("class")); }