You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by hl...@apache.org on 2008/09/03 04:01:45 UTC

svn commit: r691470 - /tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java

Author: hlship
Date: Tue Sep  2 19:01:44 2008
New Revision: 691470

URL: http://svn.apache.org/viewvc?rev=691470&view=rev
Log:
TAPESTRY-2636: NoSuchElementException on submit when using a Grid with a non-default model inside a Form

Modified:
    tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java

Modified: tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java
URL: http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java?rev=691470&r1=691469&r2=691470&view=diff
==============================================================================
--- tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java (original)
+++ tapestry/tapestry5/trunk/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Grid.java Tue Sep  2 19:01:44 2008
@@ -111,6 +111,11 @@
     private BeanModel model;
 
     /**
+     * The model parameter after modification due to the add, include, exclude and reorder parameters.
+     */
+    private BeanModel dataModel;
+
+    /**
      * The model used to handle sorting of the Grid. This is generally not specified, and the built-in model supports
      * only single column sorting. The sort constraints (the column that is sorted, and ascending vs. descending) is
      * stored as persistent fields of the Grid component.
@@ -363,7 +368,7 @@
             if (sortColumnId == null)
                 return Collections.emptyList();
 
-            PropertyModel sortModel = model.getById(sortColumnId);
+            PropertyModel sortModel = dataModel.getById(sortColumnId);
 
             SortConstraint constraint = new SortConstraint(sortModel, getColumnSort());
 
@@ -451,7 +456,9 @@
 
         if (availableRows == 0) return;
 
-        BeanModelUtils.modify(model, add, include, exclude, reorder);
+        dataModel = model;
+
+        BeanModelUtils.modify(dataModel, add, include, exclude, reorder);
 
         int maxPage = ((availableRows - 1) / rowsPerPage) + 1;
 
@@ -499,7 +506,7 @@
 
     public BeanModel getDataModel()
     {
-        return model;
+        return dataModel;
     }
 
     public GridDataSource getDataSource()