WurmD
WurmD

Reputation: 1483

h:panelGrid inconsistent allocation of cells

My page: ---

Something is causing panelGrid to create an empty cell in several rows.

I'd like to have a visible two column table, first column a label, second column an inputText element or a selectMenu with a tooltip.

My workaround was this, create a 3 column table, and when panelGrid decides not to create an empty cell, add a <br></br> to prompt it to do so.

            <h:panelGrid columns="3" style="text-align:left">
                <p:remoteCommand name="startJobActivate" actionListener="#{provisioningBean.startJobActivate}" />

                <h:outputLabel for="longitudeIdAct" value="Longitude: " />
                <p:inputText id="longitudeIdAct" value="#{provisioningBean.longitude}" title="Longitude" />
                <p:watermark for="longitudeIdAct" value="Longitude" />

                <h:outputLabel id="equipmentDropMenuActLabel" for="equipmentDropMenuAct" value="#{provisioningBean.accessDeviceLabel}" />
                <p:selectOneMenu id="equipmentDropMenuAct" value="#{provisioningBean.equipment}" title="Not needed for CSI or SIP"
                    disabled="#{provisioningBean.equipDisabled}" style="width: 100% !important">
                    <f:selectItem itemLabel=" Equipment" itemValue="" noSelectionOption="true" />
                    <f:selectItems value="#{provisioningBean.equipments}" />
                </p:selectOneMenu>
                <p:tooltip for="equipmentDropMenuAct" />

                <h:outputLabel for="rangeActId" value="Range: " />
                <p:spinner id="rangeActId" value="#{provisioningBean.rangeAct}" min="1" title="Amount of telephone numbers to provide" size="3"
                    disabled="#{provisioningBean.rangeDisabled}" />
                <br></br>
            </h:panelGrid>

Is this a bug? What am I missing here?

EDIT: Oh neat! I managed to create a minimal example and it still has the same issue :D https://gist.github.com/WurmD/f3cb45669e6871acc77462f34891862f

screenshot - you need 10 rep to post images

So this is a 3 column h:panelGrid, but the third cell is being taken up by something

EDIT2: Same behavior with p:panelGrid

Upvotes: 0

Views: 540

Answers (1)

WurmD
WurmD

Reputation: 1483

Thank you Kukeltje for this answer:

h:panelGrid columns="3" signify "start new row after each third element"

Thus, either put the watermarks (and other invisible elements) outside h:panelGrid, or use h:panelGroup to groups things that should only occupy one cell in the table:

<p:remoteCommand name="startJobActivate" actionListener="#{provisioningBean.startJobActivate}" />
<p:panelGrid columns="2" style="text-align:left">
    <h:outputLabel for="orderIdAct" value="Order Number: *" />
    <p:inputText id="orderIdAct" value="#{provisioningBean.orderNumberAct}" label="orderId" title="Order Number" />

    <h:outputLabel for="customerNameIdAct" value="Customer: *" />
    <h:panelGroup>
        <!-- h:panelGroup to group things that should only occupy 1 cell in the table -->
        <p:inputText id="customerNameIdAct" value="#{provisioningBean.customerName}" title="Customer Name" />
        <p:watermark for="customerNameIdAct" value="Customer Name" id="watermarkcustomerNameIdAct" />
    </h:panelGroup>

</p:panelGrid>
<p:panel id="executePanelAct">
    <p:commandButton value="Execute Activation" id="actvateButton" update=":form:growl" styleClass="executeButton" />
</p:panel>
<!-- Items that don't need to be in panelGrid -->
<p:watermark for="orderIdAct" value="Order Number" id="watermarkorderIdAct" />

Upvotes: 1

Related Questions