2016-01-14 7 views
1

Возможно ли каким-либо образом отобразить h: inputText между selectItems из p: selectManyCheckbox?h: inputText между p: selectManyCheckbox items

То, что я хотел бы иметь это:

  • CheckBox1
  • checkbox2
  • inputTextIfCheckbox2IsMarked (отключена, если не отмечен ..)
  • Флажок 3
  • Флажок 4

Я знаю, как сделать включение/выключение и т. но за пределами selectItems. Я бы хотел сказать это между ними.

Возможно ли это на некотором пути?

Мое решение (с inputText не между 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

ответ

3

Для PrimeFaces < 5.2.3 вы не можете. Для PrimeFaces> = 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> 
Смежные вопросы