<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Can I execute child component logic from a parent JSF Dialog</title><link>https://answers.axonivy.com/questions/1160/can-i-execute-child-component-logic-from-a-parent-jsf-dialog</link><description>&lt;p&gt;How can I call a method of a JSF-component dialog from the surrounding parent dialog?&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1160/can-i-execute-child-component-logic-from-a-parent-jsf-dialog" rel="self"></atom:link><language>en</language><lastBuildDate>Mon, 16 Feb 2015 11:37:49 -0500</lastBuildDate><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/1160/can-i-execute-child-component-logic-from-a-parent-jsf-dialog/1161</link><description>&lt;p&gt;Yes, thats possible:&lt;/p&gt;
&lt;p&gt;in the child component you have to declare a &lt;a href="http://www.primefaces.org/showcase/ui/ajax/remoteCommand.xhtml"&gt;p:remoteCommand&lt;/a&gt; that executes the child component logic. The name of this remoteCommand should be defined by a component interface attribute:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt; cc:interface componentType="IvyComponent"&amp;gt;
  &amp;lt; cc:attribute name="callbackName" /&amp;gt;
&amp;lt; /cc:interface&amp;gt;
&amp;lt; cc:implementation&amp;gt;
  &amp;lt; p:remoteCommand name="#{cc.attrs.callbackName}" actionListener="#{logic.execMyComponentLogic}"/&amp;gt;
&amp;lt; /cc:implementation&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The parent dialog can then embedd the component-dialog and define the name of the child callback method. And bind it to an oncomplete action of a commandButton:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt; ic:jsf.call.child.logic.ChildDialog callbackName="callChild" /&amp;gt;
&amp;lt; p:commandButton value="call child logic" oncomplete="callChild();"/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Mon, 16 Feb 2015 11:37:49 -0500</pubDate><guid>https://answers.axonivy.com/questions/1160/can-i-execute-child-component-logic-from-a-parent-jsf-dialog/1161</guid></item></channel></rss>