Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There should have been a switch in panelGrid to render composite components separately. I have a solution for this. You can have separate composite components instead of clubbing them together. In each composite component you can use ui:fragments to demarcate the components you want to separately fall under different columns. Following is extract from my inputText.xhtml:</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets"&gt; &lt;composite:interface&gt; &lt;composite:attribute name="id" /&gt; &lt;composite:attribute name="value" /&gt; &lt;composite:attribute name="label" /&gt; &lt;composite:attribute name="readonly" /&gt; &lt;composite:attribute name="disabled" /&gt; &lt;composite:attribute name="required" /&gt; &lt;/composite:interface&gt; &lt;composite:implementation&gt; &lt;ui:fragment id="label"&gt; &lt;h:outputText id="#{cc.attrs.id}Label" value="#{cc.attrs.label}" for="#{cc.attrs.id}" /&gt; &lt;h:outputLabel value="#{bundle['label.STAR']}" rendered="#{cc.attrs.required}" styleClass="mandatory" style="float:left"&gt;&lt;/h:outputLabel&gt; &lt;h:outputLabel value="&amp;nbsp;" rendered="#{!cc.attrs.required}" styleClass="mandatory"&gt;&lt;/h:outputLabel&gt; &lt;/ui:fragment&gt; &lt;ui:fragment id="field"&gt; &lt;h:inputText id="#{cc.attrs.id}" value="#{cc.attrs.value}" styleClass="#{not component.valid ? 'errorFieldHighlight medium' : 'medium'}" disabled="#{cc.attrs.disabled}" required="#{cc.attrs.required}" label="#{cc.attrs.label}" readonly="#{cc.attrs.readonly}"&gt; &lt;/h:inputText&gt; &lt;/ui:fragment&gt; &lt;/composite:implementation&gt; &lt;/html&gt; </code></pre> <p>Now this will not going to align in the form which is inside the panelGrid:</p> <pre><code>&lt;h:panelGrid width="100%"&gt; &lt;my:inputText label="#{bundle['label.fname']}" value="#{bean.fname}" id="fname"&gt;&lt;/my:inputtext&gt; &lt;my:inputText label="#{bundle['label.lname']}" value="#{bean.lname}" id="lname"&gt;&lt;/my:inputtext&gt; &lt;/panelGrid&gt; </code></pre> <p>So i have extended the GroupRenderer's encodeRecursive method, to add after label and a before field:</p> <pre><code>// inside my extended renderer protected void encodeRecursive(FacesContext context, UIComponent component) throws IOException { // Render our children recursively if (component instanceof ComponentRef &amp;&amp; component.getId().equals("field")) { context.getResponseWriter().startElement("td", component); } super.encodeRecursive(context, component); if (component instanceof ComponentRef &amp;&amp; component.getId().equals("label")) { context.getResponseWriter().endElement("td"); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload