You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2014/05/06 11:30:26 UTC

[jira] [Commented] (TAP5-2256) Sorting is broken for Grid inline="true" in a loop

    [ https://issues.apache.org/jira/browse/TAP5-2256?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13990476#comment-13990476 ] 

ASF subversion and git services commented on TAP5-2256:
-------------------------------------------------------

Commit 14524fecd3da310db41fee71f9bd3cb9eb22efa8 in tapestry-5's branch refs/heads/master from [~jkemnade]
[ https://git-wip-us.apache.org/repos/asf?p=tapestry-5.git;h=14524fe ]

TAP5-2256: reset the zone to null in the setup render phase, fixes zone element being rendered only for the first iteration of a loop


> Sorting is broken for Grid inline="true" in a loop
> --------------------------------------------------
>
>                 Key: TAP5-2256
>                 URL: https://issues.apache.org/jira/browse/TAP5-2256
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.3.7, 5.4
>            Reporter: Dmitry Gusev
>            Assignee: Jochen Kemnade
>
> Placing Grid with inline="true" to a loop leads to only first grid will generate zone div.
> All subsequent grids won't generate any new zone divs, instead the will target first div. So, for example, if you click sort by column on the second grid  result will appear in the first one.
> Looking at the code this the cause is that Grid instance caches value of zone property here:
> https://github.com/apache/tapestry-5/blob/5.3.7/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java#L494
> This isn't applied to 5.4, because this part was rewritten there.
> Assuming that no new 5.3.x releases will appear here is a "hacky" workaround in the form of mixin that may be applied to a grid to fix this:
> {code}
> import java.lang.reflect.Field;
> import org.apache.tapestry5.MarkupWriter;
> import org.apache.tapestry5.annotations.InjectContainer;
> import org.apache.tapestry5.annotations.MixinAfter;
> import org.apache.tapestry5.corelib.components.Grid;
> import org.apache.tapestry5.plastic.FieldConduit;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> @MixinAfter
> public class GridZoneCorrectorMixin
> {
>     private static final Logger logger = LoggerFactory.getLogger(GridZoneCorrectorMixin.class);
>     
>     @InjectContainer
>     private Grid container;
>     
>     void afterRender(MarkupWriter writer)
>     {
>         try
>         {
>             Field zoneConduitField = container.getClass().getDeclaredField("zone_FieldConduit");
>             zoneConduitField.setAccessible(true);
>             FieldConduit<?> conduit = (FieldConduit<?>) zoneConduitField.get(container);
>             conduit.set(container, null, null);
>         }
>         catch (Exception e)
>         {
>             logger.error("Error correcting grid zone", e);
>         }
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)