<br><div><span class="gmail_quote">On 10/24/07, <b class="gmail_sendername">Steve H</b> &lt;<a href="mailto:s_t_e_v_e_h@hotmail.com">s_t_e_v_e_h@hotmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>Hi<br><br>Further to my question (not yet responded to) from my prev post, is there anyone who could provide a code snippet or other insight as to how I would (presumably in the Dispatcher), invoke a different action or fragment that would update/target a different region.&nbsp;&nbsp;My attempts to date have the output from calls from the Dispatcher to any other fragments, update the region associated with the original Dispatcher run/code block.&nbsp;&nbsp;A use case might be: I have a region that can input some criteria (
e.g. search or index); In it&#39;s run code-block, I would like to use it&#39;s data (e.g. from action response or get()) to then invoke a fragment that will target a DIFFERENT region.&nbsp;&nbsp;That other region should also be able to independently function, 
e.g. next/prev from a pager, and/or submit/s to select and further process items of interest).</blockquote><div><br>I&#39;m not sure the Dispatcher is the best place to manipulate regions. The dispatcher is invoked on request by the client for a specific region, but can&#39;t really talk directly back to the client to tell it to refresh another region. For that you need a link or button that knows to refresh the other region.
<br><br>Jifty-&gt;web-&gt;link( label =&gt; _(&#39;See Group 4&#39;), onclick =&gt; { refresh =&gt; &#39;other-region&#39;, args =&gt; { group =&gt; 4 } });<br><br>I don&#39;t have a working example using the Jifty API that I can think of off hand, but I do have this in one of my app_behaviour.js scripts:
<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; element.onclick = function() {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var question_id = this.id.substr(9);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; update({<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp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bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }, this);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new Effect.ScrollTo(&#39;region-inventory&#39;, { offset: 40 });<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<br><br>This is used on report that shows a bunch of little graphs at the bottom and a &quot;monster&quot; graph at the top. Clicking on one of the little graphs causes the monster graph to update to show the same data up top. If I had done this in the Jifty API, I could have created links like:
<br><br>Jifty-&gt;web-&gt;link( label =&gt; _(&#39;This Chart&#39;), onclick =&gt; { refresh =&gt; &#39;inventory-monster-chart&#39;, args =&gt; { question_id =&gt; $question_id } } );<br><br>If I had a form that submitted an action, I could act on the action too by taking advantage of Jifty::Request::Mapper:
<br><br>Jifty-&gt;web-&gt;submit( label =&gt; _(&#39;Pick Chart&#39;), onclick =&gt; [ { submit =&gt; $some_action }, { refresh =&gt; &#39;inventory-monster-chart&#39;, args =&gt; { question_id =&gt; { result =&gt; $some_action, name =&gt; &#39;question_id&#39; } } } ] );
<br><br>This would submit the action in $some_action and then refresh the monster chart and set the new question_id to the value in $some_action-&gt;result-&gt;content(&#39;question_id&#39;) once the action was processed. I haven&#39;t done this exact thing in a bit, so I might have gotten a detail or two a little off, but that&#39;s the gist of how links/buttons can manipulate regions on the basis of the click or action submitted on click.
<br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">...if not able to be done within the original Dispatcher code-block, can/how might it be able to construct and inject a separate Request (back into the Dispatcher) that could also specify the other region as the one to output to?
<br><br>regards<br>SteveH<br><br>&gt; From: <a href="mailto:s_t_e_v_e_h@hotmail.com">s_t_e_v_e_h@hotmail.com</a><br>&gt; To: <a href="mailto:jifty-devel@lists.jifty.org">jifty-devel@lists.jifty.org</a><br>&gt; Subject: FW: Some help and/or pointers to doco: updating calling other region&#39;s/fragments from an action
<br>&gt; Date: Tue, 9 Oct 2007 11:38:08 +1000<br>&gt;<br>&gt;<br>&gt;<br>&gt;&gt; From: <a href="mailto:s_t_e_v_e_h@hotmail.com">s_t_e_v_e_h@hotmail.com</a><br>&gt;&gt; To: <a href="mailto:jifty-devel@lists.jifty.org">jifty-devel@lists.jifty.org
</a><br>&gt;&gt; Subject: Some help and/or pointers to doco: updating calling other region&#39;s/fragments from an action<br>&gt;&gt; Date: Sun, 7 Oct 2007 23:19:35 +1000<br>&gt;&gt;<br>&gt;<br>&gt;&gt; I was unable to see from doco or example, how I would cause another region/fragment to update from a different region&#39;s action.
<br>&gt;&gt; For example, I have a page that I&#39;ve composed with various Regions. One of these can have search criteria entered, another can add entries, and another includes a table of data fetched/displayed via a collection and pager. I was wanting to have the pager fragment execute to repopulate it&#39;s region following input/submit of data into either the Search region or the Add region. Both the search and add have an Action defined. I&#39;d anticipated using criteria entered in the Search, as args for the Collection used in the pager fragment.
<br>&gt;&gt; The appropriate doco or examples have so far eluded me... along with any perhaps more Jifty&#39;esq ways to do it.<br>&gt;&gt;<br>&gt;&gt;<br>&gt;<br>&gt; An update: Someone responded to me via the IRC. The penny that hadn&#39;t dropped for me was related to what is calling what/when/where... in that I was looking for how to call a fragment after processing an Action, when all along it was the fragment/s that had called the Action in the first place and thus execution would naturally return there after processing the action... so I just had to include a bit of trace/debug and look a bit closer at the call stack. All that said though, I needed to use info from args that were visible in the Action. It then became apparent that the same args were visible in the calling fragment that execution returned to... thing was though, I needed that info in a fragment that was called then from that fragment. After much poking and proding, it became apparent that I needed to declare the call to the fragment in which I need the info with a &quot;default =&gt;&quot; clause and line it up with the args in the called fragment.
<br>&gt;<br>&gt; ...so far, surviving the learning curve.<br>&gt; SteveH<br>&gt;<br>&gt; _________________________________________________________________<br>&gt; New music from the Rogue Traders - listen now!<br>&gt; <a href="http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&amp;clientID=832&amp;referral=hotmailtaglineOct07&amp;URL=http://music.ninemsn.com.au/roguetraders">
http://ninemsn.com.au/share/redir/adTrack.asp?mode=click&amp;clientID=832&amp;referral=hotmailtaglineOct07&amp;URL=http://music.ninemsn.com.au/roguetraders</a><br><br>_________________________________________________________________
<br>It&#39;s simple! Sell your car for just $30 at <a href="http://CarPoint.com.au">CarPoint.com.au</a><br><a href="http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&amp;_t=762955845&amp;_r=tig_OCT07&amp;_m=EXT_______________________________________________">
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Fsecure%2Dau%2Eimrworldwide%2Ecom%2Fcgi%2Dbin%2Fa%2Fci%5F450304%2Fet%5F2%2Fcg%5F801459%2Fpi%5F1004813%2Fai%5F859641&amp;_t=762955845&amp;_r=tig_OCT07&amp;_m=EXT_______________________________________________
</a><br>jifty-devel mailing list<br><a href="mailto:jifty-devel@lists.jifty.org">jifty-devel@lists.jifty.org</a><br><a href="http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel">http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel
</a><br></blockquote></div><br>