Question

Well, i'm starting to use Composite JSF 2.0 and i have a following problem.

This is my composite:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:p="http://primefaces.org/ui"
    xmlns:composite="http://java.sun.com/jsf/composite">

<composite:interface>

</composite:interface>

<composite:implementation>
    <p:ajax event="rowSelect" update="@form" />
    <p:ajax event="rowUnselect" update="@form" />
</composite:implementation>

</html>

And i'm trying to use this composite in this way:

<p:dataTable rowKey="#{cartao.id}" var="cartao"
                    value="#{cartaoCreditoMB.beans}" paginator="true"
                    emptyMessage="Não foi encontrado nenhum registro" rows="10"
                    id="dataTableCartoesCredito" selection="#{cartaoCreditoMB.bean}"
                    selectionMode="single">

                    <application:rowSelectUnSelect />
 </p:dataTable>

But i got the following error:

/resources/application/rowSelectUnSelect.xhtml @14,45 <p:ajax> Unable to attach <p:ajax> to non-ClientBehaviorHolder parent
Was it helpful?

Solution

These two lines :

<p:ajax event="rowSelect" update="@form" />
<p:ajax event="rowUnselect" update="@form" />

have to be nested in a component that implements the ClientBehaviourHolder interface.

Possibly, you need to nest those <p:ajax> inside the <p:dataTable> instead:

<p:dataTable ...>
   <p:ajax ... /> 
   ...
</p:dataTable>

since the DataTable class does implement the ClientBehaviourInterface.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top