子组件在facet

时间:2017-09-12 08:27:34

标签: jsf primefaces

在数据表中,可以定义自定义构面。我尝试定义的方面包含一个p:menubutton,因为这些方面包含在分页器中,p:menubutton显示在数据表的顶部和底部。第一个问题是,客户端ID是重复的(我无法打开menubutton)。我通过设置特定ID修复了此问题,请参阅https://github.com/primefaces/primefaces/pull/2651/files,但部分工作...

因为,如果放置两个p:menubutton (或其他组件)我的修复程序无法正常工作。当UIpanel方法包含多个元素时,getFacet()方法会创建UIComponent elementFacet = uidata.getFacet(element); if(elementFacet != null) { // Determines a new id String facetName = element.replaceAll("[\\W+]", "_").toLowerCase(); elementFacet.setId(uidata.getId() + facetName + position); elementFacet.encodeAll(context); } ,虽然我强制使用id但它不会将这个ID设置为子节点,但它看起来像是事件。第一,让我们看看修复:

<div id="table_form:table_form:table_paginator_top">
    <span id="table_form:table_form:j_idt246" class="ui-menubutton">
      <button id="table_form:table_form:j_idt246_button" />
    </span>
</div>

输出HTML

p:menubutton

我希望table_form:table_form:table_paginator_top包含父ID(例如.rotate{ animation: rotation 2s infinite linear; } @keyframes rotation { from { transform: rotate(0deg); } to { transform: rotate(359deg); } } ),但不是那样,为什么呢?

1 个答案:

答案 0 :(得分:0)

首先,PR必须在PF中合并。其次,创建一个像这样的虚拟合成:

<ui:component
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
    xmlns:cc="http://xmlns.jcp.org/jsf/composite">

    <cc:interface>
    </cc:interface>
    <cc:implementation>
           <cc:insertChildren />
    </cc:implementation>
</ui:component>

使用此合成包装内容构面,并且应该很好地生成ID。

重要:必须使用Mojarra 2.2.15 (尽管不知道MyFaces)

相关问题