【问题标题】:Checkbox won't update rendered value in table复选框不会更新表中的呈现值
【发布时间】:2013-04-11 20:20:23
【问题描述】:

所以这是它的瘦身。我的 selectOneMenu 上有一个渲染标签。我已经以各种方式尝试过,最后一个使用“@form”更新布尔复选框中的表单。我完全没有想法,已经工作了几天。我错过了什么,所以我可以根据复选框的选择来渲染/取消渲染?谢谢。

<rich:dataTable id="catalogview"  width="100%"  style="width: 100% !important"
    columnClasses="lcolumnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog" 
    value="#{pcnAlerts.notifications}" var="pcn" rows="20"
    headerClass="headerCatalog" styleClass="table1" footerClass="footer_td" >
    <h:column>
        <h:selectBooleanCheckbox value="#{pcn.checked}" update="@form" >
            <f:ajax listener="#{pcnAlerts.selectItem}" render=":popupForm:popupPanelContents" />
        </h:selectBooleanCheckbox>
    </h:column>
    <h:column>
        <f:facet name="header">                             
            <h:outputText value="Status" />
        </f:facet>
        <h:outputText value="#{pcn.status}" />
        <h:selectOneMenu id="StatusMenu" value="#{pcnAlerts.newStatus}" rendered="#{pcn.checked}">
            <a4j:ajax update="StatusMenu"  listener="#{pcnAlerts.saveStatus()}" />
            <f:selectItem itemValue="" itemLabel="New" />
            <f:selectItem itemValue="Pending" itemLabel="Pending" />
            <f:selectItem itemValue="Complete" itemLabel="Complete" />
            <f:selectItem itemValue="Archive" itemLabel="Archive" />
            <f:selectItem itemValue="Disregard" itemLabel="Disregard" />
        </h:selectOneMenu>
    </h:column>
</rich:dataTable>

【问题讨论】:

    标签: jsf richfaces


    【解决方案1】:

    您还必须更新catalogview 才能呈现表格内的组件。另外,请确保您的 &lt;rich:dataTable&gt;&lt;h:form&gt; 内:

    <h:form id="frmCatalog">
        <rich:dataTable id="catalogview" value="#{pcnAlerts.notifications}" var="pcn">
            <h:column>
                <h:selectBooleanCheckbox value="#{pcn.checked}">
                    <f:ajax listener="#{pcnAlerts.selectItem}"
                        render=":popupForm:popupPanelContents :frmCatalog:catalogview" />
                </h:selectBooleanCheckbox>
            </h:column>
        </rich:dataTable>
    </h:form>
    

    【讨论】:

    • 是否必须像在渲染中那样引用表单?我尝试更新目录视图,但由于它立即启动,我没有包含所有内容。
    • 另外,你的意思是把它放在渲染中吗?我认为这属于更新,对吧?
    • @user1582340 &lt;f:ajax&gt; doesn't have update attribute,你的意思是render。支持 ajax 功能的 AFAIK PrimeFaces 组件具有此 update 属性。
    • @user1582340 关于render中的表单引用,是catalogview组件的完整id,所以没有问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-01
    • 1970-01-01
    • 2023-01-13
    • 2020-01-10
    • 1970-01-01
    • 2018-04-28
    相关资源
    最近更新 更多