String expandMode = isNested ? "client" : subTable.getExpandMode();
options.put("expandMode", expandMode);
options.put("isNested", isNested);
options.put("eventOptions", AjaxRendererUtils.buildEventOptions(facesContext, subTable));
JSFunction jsFunction = new JSFunction("new RichFaces.ui.CollapsibleSubTable");
jsFunction.addParameter(id);
jsFunction.addParameter(formId);
jsFunction.addParameter(options);
writer.startElement(HtmlConstants.SCRIPT_ELEM, subTable);
writer.writeAttribute(HtmlConstants.TYPE_ATTR, HtmlConstants.JAVASCRIPT_TYPE, null);
writer.writeText(jsFunction.toScript(), null);
writer.endElement(HtmlConstants.SCRIPT_ELEM);
}