primefaces panelgrid colspan不工作

Ale*_*ves 8 jsf primefaces

我正在尝试在对话框中设置panelgrid.除了colspan之外,一切似乎都在起作用.我已经查看了这篇帖子PrimeFaces panelGrid但它的年份和一半的旧版本.从primefaces手册和展示中,colspan应该被datatable和panelGrid接受.

            <h:form id="idFormAddDialog">

            <p:panelGrid id="idPanelAddUsers" columns="2">
                <h:outputLabel for="dAddOutUser" value="Username:"></h:outputLabel>
                <h:inputText id="dAddOutUser" value="#{userController.username}"></h:inputText>
                <h:outputLabel for="dSelRole" value="Role:"></h:outputLabel>

                <h:selectOneMenu id="dSelRole" value="#{userController.role}">
                    <f:selectItem itemLabel="Admin" itemValue="1"></f:selectItem>
                    <f:selectItem itemLabel="Researcher" itemValue="2"></f:selectItem>
                    <f:selectItem itemLabel="User" itemValue="3"></f:selectItem>
                </h:selectOneMenu>

                <h:outputLabel for="dAddINPassword1" value="Password: "></h:outputLabel>
                <p:password id="dAddINPassword1" value="#{userController.password}" feedback="true"></p:password>
                <p:row>
                    <p:column colspan="2">
                        <p:separator></p:separator>
                        <!-- <p:separator></p:separator>-->
                    </p:column>
                </p:row>

                <p:commandButton value="OK" actionListener="#{userController.addUser()}"  ></p:commandButton>
                <p:button value="Cancel"></p:button>
            </p:panelGrid>
        </h:form>
Run Code Online (Sandbox Code Playgroud)

但我无法找到我做错的事.

par*_*lov 22

首先,如果你想使用p:row,并p:columnp:panelGrid删除columns属性,并与手动管理行和列p:rowp:column标签.里面的一切都p:panelGrid必须在p:row标签里面.例:

<p:panelGrid id="idPanelAddUsers">
  <p:row>
    <p:column></p:column>
    <p:column></p:column>
    <p:column></p:column>
  </p:row>
  <p:row>
    <p:column colspan="2"></p:column>
    <p:column></p:column>
  </p:row>
</p:panelGrid>
Run Code Online (Sandbox Code Playgroud)