在某种程度上,是否可以在p:selectManyCheckbox的selectItem之间显示h:inputText?
我想拥有的是:
我知道如何对复选框启用/禁用等,但在selectItems之外。我想把它放在它们之间。
这有可能吗?
我的解决方案是(inputTetem不在selectItems之间):
<h:panelGrid columns="2">
<p:selectManyCheckbox converter="otherAdmissionReasonConverter"
id="otherAdmissionReasonCheckbox"
value="#{potentialDonorFileBackingBean.potentialDonorFile.generalPatientInformation.otherAdmissionReasons}"
layout="grid" columns="1">
<f:selectItems value="#{patientInformationBackingBean.otherAdmissionReasons}"
var="otherAdmissionReason"
itemValue="#{otherAdmissionReason}"
itemLabel="#{msgs['ar.'.concat(otherAdmissionReason)]}"/>
<p:ajax update="customAdmissionReasonGrid"/>
</p:selectManyCheckbox>
<h:panelGroup id="customAdmissionReasonGrid"
styleClass="customAdmissionReason">
<p:inputText id="customAdmissionReason"
disabled="#{!potentialDonorFileBackingBean.potentialDonorFile.generalPatientInformation.otherAdmissionReasonChecked()}"
value="#{potentialDonorFileBackingBean.potentialDonorFile.generalPatientInformation.customAdmissionReason}"/>
</h:panelGroup>
</h:panelGrid>
PrimeFaces:5.2
答案 0 :(得分:3)
对于PrimeFaces&lt; 5.2.3你不能。对于PrimeFaces&gt; = 5.2.3,你可以使用这样的custom layout(©PrimeFaces)
<h3>Custom Layout (since v5.2.3)</h3>
<p:outputPanel id="customPanel" style="margin-bottom:20px">
<p:selectManyCheckbox id="custom" value="#{checkboxView.selectedConsoles2}" layout="custom">
<f:selectItem itemLabel="Xbox SixSixSix" itemValue="Xbox SixSixSix" />
<f:selectItem itemLabel="PS9" itemValue="PS9" />
<f:selectItem itemLabel="Wii Them" itemValue="Wii Them" />
</p:selectManyCheckbox>
<div class="ui-grid ui-grid-responsive">
<div class="ui-grid-row">
<div class="ui-grid-col-4">
<h:outputLabel for="opt1" value="Xbox SixSixSix" style="display:block"/>
<p:checkbox id="opt1" for="custom" itemIndex="0" />
</div>
Some Custom Text between item 1 and 2
<div class="ui-grid-col-4">
<h:outputLabel for="opt2" value="PS9" style="display:block"/>
<p:checkbox id="opt2" for="custom" itemIndex="1" />
</div>
<div class="ui-grid-col-4">
<h:outputLabel for="opt3" value="Wii Them" style="display:block"/>
<p:checkbox id="opt3" for="custom" itemIndex="2" />
</div>
</div>
</div>
</p:outputPanel>