0

I need to trigger an ajax event that is inside a panel and the panel is inside a c:forEach, how can I do this? The way I tried to do it and put the example, it does not fire the event in the bean.

This is the xhtml:

<p:panel header="Configuração de Dashboard">
            <p:dashboard id="dashBoardConfigurado" model="#{gerDashboardBean.dashboard.model}">
                <p:ajax event="reorder" listener="#{gerDashboardBean.doOrdenacao}" update=":form1:mensagem" />
                <c:forEach var="pn" items="#{gerDashboardBean.dashboard.children}">
                    <p:panel id="#{pn.id}" closable="true">
                        <p:ajax event="close" listener="#{gerDashboardBean.fecharPainel}" update=":form1:mensagem :form1:dashBoardConfigurado" />
                    </p:panel>
                </c:forEach>
            </p:dashboard>
        </p:panel>

This is the event:

public void fecharPainel(CloseEvent event) {
    for (UIComponent pn : this.dashboard.getChildren()) {
        if (pn.getId().equalsIgnoreCase(event.getComponent().getId())) {
            this.dashboard.getChildren().remove(pn);
            for (String widget : this.coluna1.getWidgets()) {
                if (widget.equalsIgnoreCase(pn.getId())) {
                    this.coluna1.removeWidget(widget);
                    break;
                }
            }
            for (String widget : this.coluna2.getWidgets()) {
                if (widget.equalsIgnoreCase(pn.getId())) {
                    this.coluna2.removeWidget(widget);
                    break;
                }
            }
        }
    }
    JsfUtil.warn("Painel removido com sucesso");
}
Selaron
  • 6,105
  • 4
  • 31
  • 39
O. Junior
  • 1
  • 3

0 Answers0