[jifty-devel] Re-use of PageRegions and Fragments
Andrew Sterling Hanenkamp
sterling at hanenkamp.com
Sat Nov 10 10:59:35 EST 2007
On Nov 8, 2007 8:54 PM, Steve H <s_t_e_v_e_h at hotmail.com> wrote:
> I was experiencing some unanticipated behaviour when I created multiple
> instances of a page region that referred to the same fragment.
> I have for example a table that lists order headers. In a row beneath the
> order header details, I create a page region whose associated fragment has
> code that, depending on it's arg values, will display a link like 'show
> items' or a nested table of the items and a link of 'hide items'. (i.ethere would be page region created for each order header listed).
> In my proof of concept code/test, I had 2 order headers that dutifully
> display along with the 'show items' link in the region/fragment under them.
> When clicking on the link for order header 1, the fragment then dutifully
> changes to show the items, along with the 'hide items' link. Problem was
> though, that when I clicked the 'show items' beneath the 2nd order hearder,
> it again updated the fragment under the 1st order header... albeit
> displaying items belonging to the order header 2; the link under order
> header 2 remained as 'show items.
Make sure when declaring your regions that you have used different names for
<% Jifty->web->region( name => 'region-1', path => '/fragment/test' ); %>
<% Jifty->web->region( name => 'region-2', path => '/fragment/test' ); %>
You can reuse paths all you want in your various regions, but region names
should not be reused unless they're nested in separate regions. (I.e., if
/fragment/test has a nested region with the same name in each, that's fine).
I don't know if that's your problem or not, but that's what it sounds like
> In the main fragment that creates these n page regions beneath their
> respective order headers, I also tried specifying a unique name... to no
> avail. In the 'show/hide item' links, I merely declare them with name=> and
> args=>; are there any other params that I should specify to cause them to
> target/update the correct page region (i.e. the one in which the link
You onclick handler should use the region=> parameter to specify which
region is targeted. This could also be your problem.
> Does that explain the issue? or might I need to send code samples?
> Overpaid or Underpaid? Check our comprehensive Salary Centre
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the jifty-devel