【问题标题】:Can not update component without a attached renderer. Component class: "class org.primefaces.component.menuitem.UIMenuItem"如果没有附加的渲染器,则无法更新组件。组件类:“类 org.primefaces.component.menuitem.UIMenuItem”
【发布时间】:2015-01-01 21:14:35
【问题描述】:

我的页面上有一条警告:

Can not update component without a attached renderer. Component class: "class org.primefaces.component.menuitem.UIMenuItem"

它运行良好,但我仍然收到此警告消息。我所拥有的是一个表格,它应该根据选择的行向用户显示上下文菜单,呈现一些菜单项或不呈现。

这是我的桌子:

<p:dataTable id="protocoloTable" var="protocolo" value="#{juridicaBean.protocolsLazy}" paginator="true" lazy="true" selectionMode="single"
            selection="#{protocoloBean.selectedEntity}">
            <p:ajax event="contextMenu" update=":registration_form:protocoloTableMenu" oncomplete="protoMenu.show(currentEvent);" process="protocoloTable" />

这是菜单:

<p:contextMenu id="protocoloTableMenu" for="protocoloTable" widgetVar="protoMenu">
    <p:menuitem value="Visualizar protocolo" icon="icon-ticket icon-large" actionListener="#{ocorrenciaBean.loadViewOcorrencias(protocoloBean.selectedEntity)}"
                process="@this" update="view_proto_details" oncomplete="PF('viewProtocolDlg').show()"></p:menuitem>
    <p:menuitem value="Nova ocorrência" icon="icon-plus icon-large" actionListener="#{ocorrenciaBean.newOcorrencia(protocoloBean.selectedEntity)}" oncomplete="PF('ocorrenciaDlg').show()" process="@this" update="ocorrencia_details" rendered="#{protocoloBean.selectedEntity.status eq 'PENDENTE'}"></p:menuitem>
    <p:menuitem value="Reabrir protocolo" icon="icon-unlock-alt icon-large" rendered="#{protocoloBean.selectedEntity.status eq 'CONCLUIDO'}"
                actionListener="#{protocoloBean.openProtocol()}" update="protocoloTable" process="@this"></p:menuitem>

PF4

【问题讨论】:

    标签: jsf primefaces


    【解决方案1】:

    我知道这个问题已经过时了,但我很好奇你是否直接从代码中使用 UIMenuItem?

    • 如果是这样,您是否尝试过改用MenuModel - MenuItem (DefaultMenuModel/DynamicMenuModel - DefaultMenuItem)?

    • 您还应该考虑为您在 contextMenu 中使用的 每个 项使用 id

    【讨论】:

      猜你喜欢
      • 2021-03-26
      • 2021-12-15
      • 2013-08-11
      • 2020-09-25
      • 1970-01-01
      • 2021-06-17
      • 1970-01-01
      • 2021-08-20
      • 2021-07-05
      相关资源
      最近更新 更多