【问题标题】:Display options onclicking h:selectOneRadio单击 h:selectOneRadio 时显示选项
【发布时间】:2012-05-11 23:13:45
【问题描述】:

我有一个单选按钮,一旦被选中,我想显示几个与其相关的选项。这些选项位于相关的 bean 上。我该怎么做?

<h:panelGrid columns="2" cellpadding="0" cellspacing="0" >
    <h:selectOneRadio value="#{managePaymentModel.reportFilter.options}" layout="pageDirection" label="Select Option" disabled="#{managePaymentModel.reportPreview}">
        <f:selectItems value="#{managePaymentModel.reportOptions}" var="type" itemValue="#{type.value}" itemLabel="#{type.label}" />
    </h:selectOneRadio>
</h:panelGrid>
@Override
public Map reportSelector() {
    Map<Integer, String> map = new HashMap<Integer, String>();
    map.put(ManagePaymentBeanLocal.LIST_PAYMENTS_SUMMARY, "List of Payments Summary");
    map.put(ManagePaymentBeanLocal.LIST_PAYMENTS_DETAIL, "List of Payments Detail");
    return map;
}
@Override
public Map reportOptions(ReportFilter filter) {
    Map<Integer, String> option = new HashMap<Integer, String>();
    // report configurations
    switch (filter.getSelect()) {
        case ManagePaymentBeanLocal.LIST_PAYMENTS_SUMMARY:
        case ManagePaymentBeanLocal.LIST_PAYMENTS_DETAIL:
            option.put(ReportFilter.OPTION1, "By Beneficiary");
            option.put(ReportFilter.OPTION2, "By Reference");
            break;
    }
    return option;
}

【问题讨论】:

  • 能否说明您的问题
  • 抱歉.. 刚刚编辑了问题。
  • 我仍然不知道您具体要问什么。功能要求是什么?
  • 抱歉,我在表述问题时遇到了问题。问题是,我的 xhtml 上有两个单选按钮,显示“付款摘要列表”和“付款详细信息列表”,当有人单击第二个选项,即“付款明细列表”,再出现两个选项,即“按受益人”和“按参考”出现..

标签: jsf primefaces


【解决方案1】:

您可以将此代码放在您的 selectOneRadio 中

<f:ajax event="change" render="@form" />

这将更新后面的模型并重新渲染公式

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2017-03-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多