1

I have two p:ajax tags registered for the same rowSelect event on a datatable.

One p:ajax resides inside a composite component to only update common regions in the page, the other p:ajax has a listener and it is registered outside the composite component.

I observed the listener from the outside p:ajax to be called twice. How can the listener method be executed one time only, as it is registered only on one p:ajax tag?

<myComp:dataTable  ...>
    <p:ajax event="rowSelect" update=":form:tableDetails" listener="#{backingBean.selectRow}"/>
</myComp:dataTable>

and here the CC code:

<cc:interface >
    <cc:clientBehavior event="rowSelect" name="rowSelect" targets="#{cc.clientId}:dataTable" />
</cc:interface>
<cc:implementation>
    <p:dataTable    id="dataTable" ...>
      <p:ajax event="rowSelect" update=":form:footPanelAndButtons"/>
    </p:dataTable>
</cc:implementation>

I omitted the most of the attributes on the tags to keep it simple.

I know this is might be a performance issue since client/server communication occurs twice for the same event.

jonnie119
  • 421
  • 1
  • 6
  • 16

1 Answers1

0

They end up on the same datatable (that is how you specified it via the targets attribute on the <cc:clientBehavior.../>) and you cannot have to identical events (both rowSelect) on the same component. That is just a limitation of the PF components. Normally the last one is executed twice (see link below) but I don't know which one that will be in this construct. If the method is called twice, you know...

See also

Community
  • 1
  • 1
Kukeltje
  • 12,223
  • 4
  • 24
  • 47