<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: How to access Component dialogs</title><link>https://answers.axonivy.com/questions/530/how-to-access-component-dialogs</link><description>&lt;p&gt;Hello Ivy Team&lt;/p&gt;
&lt;p&gt;I have some questions concerning the &lt;strong&gt;access of Components data, methods and updating&lt;/strong&gt; in ivy-jsf.&lt;br&gt;
Some points might not been implemented yet so consider these also as ideas or wishes.&lt;/p&gt;
&lt;p&gt;In my example there is a main dialog which implements 2 components:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;ic:ch.itpoint.mms.care.ItemEdit startMethod="startNew" callback="#{logic}" /&amp;gt;
&amp;lt;ic:ch.itpoint.mms.show.ItemList startMethod="start" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;There are two targets I want to reach:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Creating a Item or editing it should update the ItemList&lt;/li&gt;
&lt;li&gt;Selecting an Item in the List should open the Object in the Item-Editor&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;One restriction is, that all that should be build up like described with components. Saving events will be handled first in the component, then in the main-page. Another might be to preferably stay away from self made javascripts.&lt;br&gt;&lt;br&gt;
I achieved, that I can save the Item and call a method (itemSaved()) via the callback on the main-page at the same time:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;p:commandButton value="#{ivy.cms.co('/lables/save')} - Callback"
actionListener="#{logic.saveItem}" action="#{cc.attrs.callback.itemSaved}" ajax="true" icon="ui-icon-disk" update="itemForm,:j_id_s:itemsListeForm" /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That's allready something, but I didn't find any way to access the List-Component.&lt;br&gt;
In the end I would see these possibilities:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Having access to components methods / events, which also provoke an update in the view.&lt;/li&gt;
&lt;li&gt;Having access to components data from main page. And some kind of dataChangeListener to update the view.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Two possible solutions I see:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;An object of the compoenent in jsf (with possible access in the logic)&lt;/li&gt;
&lt;li&gt;Same object in the logic (same as ULC-components)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;An Update could exceptionally be fired by the update-Attribute :j_id_s:itemsListeForm in the brother-component (I don't know if it would work)&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Thank you for your support!&lt;br&gt;&lt;/p&gt;
&lt;p&gt;Greetings&lt;br&gt;
Alexis Suter&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/530/how-to-access-component-dialogs" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 19 Feb 2014 15:40:10 -0500</lastBuildDate><item><title>Answer by Raphael Bürgin</title><link>https://answers.axonivy.com/questions/530/how-to-access-component-dialogs/532</link><description>&lt;p&gt;Hello Alexis,&lt;/p&gt;
&lt;p&gt;In the interface of your component you can set the input and output arguments.&lt;/p&gt;
&lt;p&gt;In the output arguments you set the attributs you need on the parent component (value1, value2).&lt;/p&gt;
&lt;p&gt;In the input arguments you set the attributs you need on the child component (value3).
Now you can bind the attribut to the data class of the parent component like this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;ic:ch.test value1=#{data.value1} value2=#{data.value2} value3=#{data.value3} /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Every time the logic of the child component hits a endpoint you can update the form and you have the new values.&lt;/p&gt;
&lt;p&gt;To update something from the parentComponent in the ChildComponent you can use this code snippet &lt;/p&gt;
&lt;p&gt;&lt;code&gt;update="#{cc.id}:form"&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;When I need a form in the childcomponent and update it with some commands on the parentComponent I always declare the form before I include the component&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;h:form id="form4Component"&amp;gt;
&amp;lt;ic:ch.test value1=#{data.value1} value2=#{data.value2} value3=#{data.value3} /&amp;gt;
&amp;lt;/h:form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;strong&gt;hint:&lt;/strong&gt; if you want to avoid ids made by primfaces &lt;code&gt;j_id_s:itemsListeForm&lt;/code&gt; you can set &lt;code&gt;prependId=false&lt;/code&gt; on the form.&lt;/p&gt;
&lt;p&gt;regards Raphael&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Raphael Bürgin</dc:creator><pubDate>Wed, 19 Feb 2014 15:40:10 -0500</pubDate><guid>https://answers.axonivy.com/questions/530/how-to-access-component-dialogs/532</guid></item></channel></rss>