Note that there are some explanatory texts on larger screens.

plurals
  1. POa composite component inside panelgrid is not 'expanded'
    primarykey
    data
    text
    <p>Basically, i've been using this pattern again and again inside a panelgrid :</p> <pre><code>&lt;h:panelGrid columns="2" &gt; &lt;h:outputLabel for="heroName" value="Hero Name : " /&gt; &lt;h:panelGroup&gt; &lt;h:inputText label="Hero Name : " value="#{ccBean.data.map['heroName']}" id="heroName" /&gt; &lt;p:message for="heroName" /&gt; &lt;/h:panelGroup&gt; ... &lt;/h:panelGrid&gt; </code></pre> <p>I notice that i duplicate things so much, like the id in h:inputText, which will be duplicated again in <em>for="idValue"</em> for outputLabel, and then again in <em>p:message</em>. The same thing happens with the inputText's <em>label</em> value and <em>h:outputLabel</em> value.</p> <p>So, i was thinking about making a simple composite component to wrap these up :</p> <pre><code>&lt;composite:interface&gt; &lt;composite:attribute name="id" required="true" /&gt; &lt;composite:attribute name="label" required="true" /&gt; &lt;composite:attribute name="value" required="true" /&gt; &lt;composite:attribute name="includeLabel" required="false" default="false"/&gt; &lt;/composite:interface&gt; &lt;composite:implementation&gt; &lt;h:outputLabel for="#{cc.attrs.id}" value="#{cc.attrs.label}" render="#{cc.attrs.includeLabel}" /&gt; &lt;h:panelGroup&gt; &lt;h:inputText label="#{cc.attrs.label}" value="#{cc.attrs.value}" id="#{cc.attrs.id}" /&gt; &lt;p:message for="#{cc.attrs.id}" /&gt; &lt;/h:panelGroup&gt; &lt;/composite:implementation&gt; </code></pre> <p>And then i make use of the composite components :</p> <pre><code>&lt;h:panelGrid columns="2" &gt; &lt;s:inputText id="heroName" label="Hero Name : " value="#{ccBean.data.map['heroName']}" includeLabel="true" /&gt; &lt;s:inputText id="heroName2" label="Hero Name 2 : " value="#{ccBean.data.map['heroName2']}" includeLabel="true" /&gt; ... &lt;/h:panelGrid&gt; </code></pre> <p>That composite component works fine, but the panelGrid now assumes that the s:inputText is one component. Before using the composite component, there are 2 components in one row, which is the outputLabel and the panelGroup.</p> <p>Is it possible to hint the composite component to 'expand' itself in this case so that it takes up 2 columns instead of 1 column in my panelGrid ?</p> <p>Thank you !</p>
    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.
 

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