JSF组件呈现AJAX单选按钮选择 [英] JSF render component ajax radio button selection

查看:257
本文介绍了JSF组件呈现AJAX单选按钮选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题的后续行动<一个href="http://stackoverflow.com/questions/32512567/jsf-primefaces-radio-button-show-hide-enable-a-textarea/32518195#32518195">JSF Primefaces单选按钮显示/隐藏/启用一个textarea 其中的两个问题是从执行后解决了包裹inputTextArea在panelGroup中,但是我还需要弄清楚如何才能不显示在表格负荷inputTextArea当状态是2(=否),但只显示在列2无线电被触发。

This Question is a follow up to JSF Primefaces Radio Button show/hide/enable a textarea One of the two problems were solved from that Post by wrapping the inputTextArea in a panelGroup, however I still need to figure out how to not show the inputTextArea on form load when the status is a 2 (=No), but only show when the radio under column 2 is being toggled.


输入图像的描述在这里

    <p:column ...>
        <p:selectOneRadio ...>
        ...
            <p:ajax update="reason" />
        </p:selectOneRadio>
    </p:column>
    <p:column headerText="Reason For Attribute Failure">
      <h:panelGroup id="reason">
        <h:inputTextarea value="#{qAndA.fail_reason}" rendered="#{qAndA.toggle_value == '2'}" />
      </h:panelGroup>

        <h:outputText value="" rendered="#{qAndA.toggle_value == '1' or qAndA.toggle_value == '3'}" />
     <h:outputText value="#{qAndA.fail_reason}" rendered="#{qAndA.toggle_value == '2' or qAndA.toggle_value == '4'}" />

    </p:column>

也许是状态codeS是有缺陷的:

perhaps the status codes are flawed:

  • 0 =无输入又
  • 1 = YES
  • 2 =无,有一个原因
  • 3 =不适用
  • 4 =在没有最终解决

我宁愿没有修改的状态codeS,但增加一个中间code,这样的事情可能会工作:

I'd rather not have to modify the status codes but adding another intermediate code, something like this would probably work:

  • 2 =显示原因箱
  • 2.5意味着没有一个理由

除了修改状态$ C $(c)任何其他的选择吗?

Any other options besides modifying status code?

推荐答案

那么真正的答案是没有价值在2时,如果你想不显示它的bean被装载。但是你已经知道了。你所问的是主观的给你,你想怎么做的事情。你没有问题,这更是一个设计问题。如此说来这里是:

Well the real answer is to not have the value at 2 when the bean is loaded if you want to not display it. But you already know that. What you are asking is subjective to you and how you wanna do things. You have no issue and this is more a design question. Having said that here is one:

也许你想有2个条件:

<h:inputTextarea value="#{qAndA.fail_reason}" rendered="#{qAndA.toggle_value == '2' and bean.AnotherCondition}" />

如果你想获得花式做出 @ViewScoped 的bean听你在您的文章在谈论点击(不知道点击一样)。侦听的点击,并有一个布尔属性,您可以设置为true,一旦点击已注册(可能与动作侦听器)。这样,点击后的文本域将只显示。

If you wanna get fancy make a @ViewScoped bean that listen for the click you were talking about in your post ( not sure what the click does). Listen for the click and have a boolean property you can set to true once the click has been registered (maybe with an action listener). This way the textarea will only show when clicked.

这篇关于JSF组件呈现AJAX单选按钮选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆