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
Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/14524fec Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/14524fec Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/14524fec Branch: refs/heads/master Commit: 14524fecd3da310db41fee71f9bd3cb9eb22efa8 Parents: 6a63e75 Author: Jochen Kemnade <jochen.kemn...@eddyson.de> Authored: Tue May 6 11:13:50 2014 +0200 Committer: Jochen Kemnade <jochen.kemn...@eddyson.de> Committed: Tue May 6 11:26:55 2014 +0200 ---------------------------------------------------------------------- .../tapestry5/corelib/components/Grid.java | 2 ++ .../src/test/app1/InplaceGridInLoopDemo.tml | 22 ++++++++++++++++ .../tapestry5/integration/app1/GridTests.java | 20 +++++++++++++++ .../tapestry5/integration/app1/pages/Index.java | 4 ++- .../app1/pages/InplaceGridInLoopDemo.java | 27 ++++++++++++++++++++ 5 files changed, 74 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/14524fec/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java index 2a37214..dd3fda4 100644 --- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java +++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java @@ -440,6 +440,8 @@ public class Grid implements GridModel, ClientElement Object setupRender() { + zone = null; + if (formSupport != null) formSupport.store(this, SETUP_DATA_SOURCE); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/14524fec/tapestry-core/src/test/app1/InplaceGridInLoopDemo.tml ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/app1/InplaceGridInLoopDemo.tml b/tapestry-core/src/test/app1/InplaceGridInLoopDemo.tml new file mode 100644 index 0000000..e12609b --- /dev/null +++ b/tapestry-core/src/test/app1/InplaceGridInLoopDemo.tml @@ -0,0 +1,22 @@ +<html t:type="Border" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd"> + + <h1>In-Place Grid in a Loop Demo</h1> + + <t:loop source="[1,2]" value="index"> + <t:any class="prop:containerclass"> + <table t:type="grid" t:id="grid" source="tracks" row="track" inplace="true" rowsPerPage="5"> + <t:parameter name="ratingheader"> + <t:actionlink t:id="sortRating">Sort Rating</t:actionlink> + </t:parameter> + <t:parameter name="ratingcell"> + <t:outputRating rating="track.rating"/> + </t:parameter> + </table> + </t:any> + </t:loop> + + <p> + [<t:actionlink t:id="reset">reset the Grids</t:actionlink>] + </p> + +</html> http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/14524fec/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java index 1a55695..2d5f7b3 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/GridTests.java @@ -332,4 +332,24 @@ public class GridTests extends App1TestCase assertAttribute("//a[contains(@href,'columns:sort')]/@rel", "nofollow"); } + /** + * TAP5-2256 + */ + @Test + public void sorting_inplace_grid_in_a_loop() + { + openLinks("In-Place Grid in a Loop Demo", "reset the Grids"); + + click("css=.grid1 th[data-grid-property='title'] a"); + waitForAjaxRequestsToComplete(); + click("css=.grid2 th[data-grid-property='album'] a"); + waitForAjaxRequestsToComplete(); + assertAttribute("css=.grid1 th[data-grid-property='title']/@data-grid-column-sort", "ascending"); + assertAttribute("css=.grid2 th[data-grid-property='album']/@data-grid-column-sort", "ascending"); + assertAttribute("css=.grid2 th[data-grid-property='title']/@data-grid-column-sort", "sortable"); + + + } + + } http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/14524fec/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java index bfd68f3..b516ef7 100644 --- a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/Index.java @@ -561,7 +561,9 @@ public class Index new Item("PartialTemplateRendererDemo", "PartialTemplateRenderer Demo", "Shows some examples of rendering blocks and components to a String using PartialTemplateRenderer"), - new Item("nested/PageThatThrowsException", "Reload on nested page", "Tests a page reload from a nested page's exception report") + new Item("nested/PageThatThrowsException", "Reload on nested page", "Tests a page reload from a nested page's exception report"), + + new Item("inplacegridinloopdemo", "In-Place Grid in a Loop Demo", "In-place grid in a loop") ); http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/14524fec/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/InplaceGridInLoopDemo.java ---------------------------------------------------------------------- diff --git a/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/InplaceGridInLoopDemo.java b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/InplaceGridInLoopDemo.java new file mode 100644 index 0000000..6337cec --- /dev/null +++ b/tapestry-core/src/test/java/org/apache/tapestry5/integration/app1/pages/InplaceGridInLoopDemo.java @@ -0,0 +1,27 @@ +// Copyright 2008, 2011 The Apache Software Foundation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package org.apache.tapestry5.integration.app1.pages; + +import org.apache.tapestry5.annotations.Property; + +public class InplaceGridInLoopDemo extends GridDemo { + + @Property + private int index; + + public String getContainerClass() { + return "grid" + index; + } +}