You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tapestry.apache.org by "Skow (JIRA)" <de...@tapestry.apache.org> on 2008/07/12 21:19:31 UTC

[jira] Created: (TAPESTRY-2518) Saving a form with a Grid after sorting saves data to incorrect rows.

Saving a form with a Grid after sorting saves data to incorrect rows.
---------------------------------------------------------------------

                 Key: TAPESTRY-2518
                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2518
             Project: Tapestry
          Issue Type: Bug
          Components: tapestry-core
    Affects Versions: 5.0.13
            Reporter: Skow


I could be doing something wrong, but it seems as though saving a Grid of objects which is included in a Form after sorting the Grid to a non-default sort order results in the rows getting saved under an incorrect ID.  

This should be reproducible in any form which includes an editable Grid, but here are the basic steps to reproduce what I'm seeing:
1.  Create an Item class which includes an ID column and a Name column (I have mine set up as a Hibernate object)
2.  Create a Page with a Grid of Items inside a Form including a Save button which causes the Page to persist the Items
3.  Create a couple Items (ID, name):
      (1, 'item one')
      (2, 'item two')
4.  Bring up the Page, Sort by ID (or Name) so they look like this:
      (2, 'item two')
      (1, 'item one')
5.  Click Save and if I'm not mistaken you will see:
      (2, 'item one')      <-- Note that Item 2 is now associated with the name of Item 1...
      (1, 'item two')

Please let me know if there is any difficulty in reproducing this issue and I will try to put together a minimal code example.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAP5-34) Saving a form with a Grid after sorting saves data to incorrect rows.

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/TAP5-34?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12644160#action_12644160 ] 

Howard M. Lewis Ship commented on TAP5-34:
------------------------------------------

I found the primary cause of this; CachingDataSource (inside Grid) was accessing the underlying source parameter directly; during a form submission, this value isn't cached, each access results in a fresh access of the underlying data source, which often means that the sort constraints (via prepare()) were lost, and the elements in the data source accessed and updated in a arbitrary order.

I'm fixing that (CachingDataSource will be a static inner class and hold a direct reference to the underlying data source), but I'm also adding PrimaryKeyEncoder support to Grid and GridRows, as with Loop.

> Saving a form with a Grid after sorting saves data to incorrect rows.
> ---------------------------------------------------------------------
>
>                 Key: TAP5-34
>                 URL: https://issues.apache.org/jira/browse/TAP5-34
>             Project: Tapestry 5
>          Issue Type: Bug
>    Affects Versions: 5.0.15
>            Reporter: Skow
>            Assignee: Howard M. Lewis Ship
>
> I could be doing something wrong, but it seems as though saving a Grid of objects which is included in a Form after sorting the Grid to a non-default sort order results in the rows getting saved under an incorrect ID.  
> This should be reproducible in any form which includes an editable Grid, but here are the basic steps to reproduce what I'm seeing:
> 1.  Create an Item class which includes an ID column and a Name column (I have mine set up as a Hibernate object)
> 2.  Create a Page with a Grid of Items inside a Form including a Save button which causes the Page to persist the Items
> 3.  Create a couple Items (ID, name):
>       (1, 'item one')
>       (2, 'item two')
> 4.  Bring up the Page, Sort by ID (or Name) so they look like this:
>       (2, 'item two')
>       (1, 'item one')
> 5.  Click Save and if I'm not mistaken you will see:
>       (2, 'item one')      <-- Note that Item 2 is now associated with the name of Item 1...
>       (1, 'item two')
> Please let me know if there is any difficulty in reproducing this issue and I will try to put together a minimal code example.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Closed: (TAP5-34) When using a Grid inside a Form, sorting the Grid may cause updates (when the form is submitted) to be applied to the wrong objects

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-34?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship closed TAP5-34.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 5.0.16

> When using a Grid inside a Form, sorting the Grid may cause updates (when the form is submitted) to be applied to the wrong objects
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-34
>                 URL: https://issues.apache.org/jira/browse/TAP5-34
>             Project: Tapestry 5
>          Issue Type: Bug
>    Affects Versions: 5.0.15
>            Reporter: Skow
>            Assignee: Howard M. Lewis Ship
>             Fix For: 5.0.16
>
>
> I could be doing something wrong, but it seems as though saving a Grid of objects which is included in a Form after sorting the Grid to a non-default sort order results in the rows getting saved under an incorrect ID.  
> This should be reproducible in any form which includes an editable Grid, but here are the basic steps to reproduce what I'm seeing:
> 1.  Create an Item class which includes an ID column and a Name column (I have mine set up as a Hibernate object)
> 2.  Create a Page with a Grid of Items inside a Form including a Save button which causes the Page to persist the Items
> 3.  Create a couple Items (ID, name):
>       (1, 'item one')
>       (2, 'item two')
> 4.  Bring up the Page, Sort by ID (or Name) so they look like this:
>       (2, 'item two')
>       (1, 'item one')
> 5.  Click Save and if I'm not mistaken you will see:
>       (2, 'item one')      <-- Note that Item 2 is now associated with the name of Item 1...
>       (1, 'item two')
> Please let me know if there is any difficulty in reproducing this issue and I will try to put together a minimal code example.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Updated: (TAP5-34) When using a Grid inside a Form, sorting the Grid may cause updates (when the form is submitted) to be applied to the wrong objects

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-34?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship updated TAP5-34:
-------------------------------------

    Summary: When using a Grid inside a Form, sorting the Grid may cause updates (when the form is submitted) to be applied to the wrong objects  (was: Saving a form with a Grid after sorting saves data to incorrect rows.)

> When using a Grid inside a Form, sorting the Grid may cause updates (when the form is submitted) to be applied to the wrong objects
> -----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: TAP5-34
>                 URL: https://issues.apache.org/jira/browse/TAP5-34
>             Project: Tapestry 5
>          Issue Type: Bug
>    Affects Versions: 5.0.15
>            Reporter: Skow
>            Assignee: Howard M. Lewis Ship
>
> I could be doing something wrong, but it seems as though saving a Grid of objects which is included in a Form after sorting the Grid to a non-default sort order results in the rows getting saved under an incorrect ID.  
> This should be reproducible in any form which includes an editable Grid, but here are the basic steps to reproduce what I'm seeing:
> 1.  Create an Item class which includes an ID column and a Name column (I have mine set up as a Hibernate object)
> 2.  Create a Page with a Grid of Items inside a Form including a Save button which causes the Page to persist the Items
> 3.  Create a couple Items (ID, name):
>       (1, 'item one')
>       (2, 'item two')
> 4.  Bring up the Page, Sort by ID (or Name) so they look like this:
>       (2, 'item two')
>       (1, 'item one')
> 5.  Click Save and if I'm not mistaken you will see:
>       (2, 'item one')      <-- Note that Item 2 is now associated with the name of Item 1...
>       (1, 'item two')
> Please let me know if there is any difficulty in reproducing this issue and I will try to put together a minimal code example.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Assigned: (TAP5-34) Saving a form with a Grid after sorting saves data to incorrect rows.

Posted by "Howard M. Lewis Ship (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/TAP5-34?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Howard M. Lewis Ship reassigned TAP5-34:
----------------------------------------

    Assignee: Howard M. Lewis Ship

> Saving a form with a Grid after sorting saves data to incorrect rows.
> ---------------------------------------------------------------------
>
>                 Key: TAP5-34
>                 URL: https://issues.apache.org/jira/browse/TAP5-34
>             Project: Tapestry 5
>          Issue Type: Bug
>    Affects Versions: 5.0.15
>            Reporter: Skow
>            Assignee: Howard M. Lewis Ship
>
> I could be doing something wrong, but it seems as though saving a Grid of objects which is included in a Form after sorting the Grid to a non-default sort order results in the rows getting saved under an incorrect ID.  
> This should be reproducible in any form which includes an editable Grid, but here are the basic steps to reproduce what I'm seeing:
> 1.  Create an Item class which includes an ID column and a Name column (I have mine set up as a Hibernate object)
> 2.  Create a Page with a Grid of Items inside a Form including a Save button which causes the Page to persist the Items
> 3.  Create a couple Items (ID, name):
>       (1, 'item one')
>       (2, 'item two')
> 4.  Bring up the Page, Sort by ID (or Name) so they look like this:
>       (2, 'item two')
>       (1, 'item one')
> 5.  Click Save and if I'm not mistaken you will see:
>       (2, 'item one')      <-- Note that Item 2 is now associated with the name of Item 1...
>       (1, 'item two')
> Please let me know if there is any difficulty in reproducing this issue and I will try to put together a minimal code example.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org


[jira] Commented: (TAPESTRY-2518) Saving a form with a Grid after sorting saves data to incorrect rows.

Posted by "Howard M. Lewis Ship (JIRA)" <de...@tapestry.apache.org>.
    [ https://issues.apache.org/jira/browse/TAPESTRY-2518?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12628666#action_12628666 ] 

Howard M. Lewis Ship commented on TAPESTRY-2518:
------------------------------------------------

At issue here is that the Grid stores row *indexes* into the form, not the primary key of the row.  It might be nice to change that.  Like Loop, Grid should be use a PrimaryKeyEncoder  (optionally).  However, this may also be related to TAPESTRY-2636, meaning that the Grid will work correctly as long as the underlying data has not shifted (had rows added or removed).

> Saving a form with a Grid after sorting saves data to incorrect rows.
> ---------------------------------------------------------------------
>
>                 Key: TAPESTRY-2518
>                 URL: https://issues.apache.org/jira/browse/TAPESTRY-2518
>             Project: Tapestry
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.0.13
>            Reporter: Skow
>
> I could be doing something wrong, but it seems as though saving a Grid of objects which is included in a Form after sorting the Grid to a non-default sort order results in the rows getting saved under an incorrect ID.  
> This should be reproducible in any form which includes an editable Grid, but here are the basic steps to reproduce what I'm seeing:
> 1.  Create an Item class which includes an ID column and a Name column (I have mine set up as a Hibernate object)
> 2.  Create a Page with a Grid of Items inside a Form including a Save button which causes the Page to persist the Items
> 3.  Create a couple Items (ID, name):
>       (1, 'item one')
>       (2, 'item two')
> 4.  Bring up the Page, Sort by ID (or Name) so they look like this:
>       (2, 'item two')
>       (1, 'item one')
> 5.  Click Save and if I'm not mistaken you will see:
>       (2, 'item one')      <-- Note that Item 2 is now associated with the name of Item 1...
>       (1, 'item two')
> Please let me know if there is any difficulty in reproducing this issue and I will try to put together a minimal code example.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tapestry.apache.org
For additional commands, e-mail: dev-help@tapestry.apache.org