0

我想在 f:selectItem 旁边显示 p:inputText 并获得如下图所示的结果: 在此处输入图像描述

用我的代码:

<p:selectManyCheckbox id="s1" value="#{myBean.selectedValues}" layout="pageDirection" >
    <f:selectItem itemLabel="value 1" itemValue="v1" />
    <f:selectItem itemLabel="value 2" itemValue="v2" />
    <f:selectItem itemLabel="value 3" itemValue="v3" />
    <p:inputText id="input1" value="#{myBean.input1Value}" />

</p:selectManyCheckbox>

inputText 已在 selectItems 之前显示:

在此处输入图像描述

我也尝试过将 inputText 放入 selectItem 标记,但结果是一样的。

<f:selectItem itemLabel="value 3" itemValue="v3">
    <p:inputText id="input1" value="#{myBean.input1Value}" />
</f:selectItem>
4

1 回答 1

0

最简单的方法是使用p:panelGridwithcolumns="2"

<p:panelGrid columns="2">  
    <p:selectManyCheckbox....
    </p:selectManyCheckbox>
    <p:inputText id="input1" value="#{myBean.input1Value}" />
</p:panelGrid>  

看看Primefaces PanelGrid的其他示例

于 2012-08-08T08:24:30.517 回答