Tapestry 5
  1. Tapestry 5
  2. TAP5-835

Palette keeps resetting order of selected values on page reload

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 5.3, 5.2.0, 5.2.1, 5.2.2, 5.2.3, 5.2.4, 5.2.5, 5.1.0.5, 5.1.0.6, 5.1.0.7, 5.0.18
    • Fix Version/s: 5.3
    • Component/s: tapestry-core
    • Labels:
      None
    • Environment:
      affects Tapestry versions 5.0.x.x, 5.2.x and the current 5.3 version regardless of OS/browser

      Description

      I'm experiencing a problem with tapestry's palette component. I'm using it with the reorder parameter set to true. Reordering the
      selected values works fine and the values are sent to the server in the expected order. However, if the page reloads and I submit the
      containing form again without changing the palette's values, the original order is restored and sent to the server resetting the
      previously arranged order.
      AFAICT, this relates to the hidden form field used by the palette and the updateHidden Javascript method. This method is called whenever the
      order of the selected options is changed. It is not called however when the Palette object is instantiated, so the hidden field keeps the
      sorting that comes from the server.
      I believe, this could be fixed by calling the updateHidden method at the end of the Tapestry.Palette.initialize method. The following patch
      does this:

      Index: palette.js
      ===================================================================
      — palette.js (Revision 755168)
      +++ palette.js (Arbeitskopie)
      @@ -45,6 +45,7 @@
      }.bind(this));

      this.bindEvents();
      + this.updateHidden();
      },

      bindEvents : function()

        Activity

        Jochen Kemnade created issue -
        Howard M. Lewis Ship made changes -
        Field Original Value New Value
        Project Tapestry [ 10573 ] Tapestry 5 [ 12310833 ]
        Key TAPESTRY-2741 TAP5-835
        Affects Version/s 5.1 [ 12312964 ]
        Component/s Core Components [ 12311677 ]
        Jochen Kemnade made changes -
        Affects Version/s 5.0.18 [ 12313543 ]
        Affects Version/s 5.1.0.5 [ 12313913 ]
        Affects Version/s 5.1.0.6 [ 12314399 ]
        Component/s tapestry-core [ 12312470 ]
        Jochen Kemnade made changes -
        Affects Version/s 5.1.0.7 [ 12314494 ]
        Hide
        Randall Rupper added a comment - - edited

        Please fix it. It's about a 14-line workaround every time I use a palette. Thank you!

        Show
        Randall Rupper added a comment - - edited Please fix it. It's about a 14-line workaround every time I use a palette. Thank you!
        Hide
        Jochen Kemnade added a comment -

        I created a mixin for the Palette component that fixes the issue until a real fix is released, feel free to use it.

        Show
        Jochen Kemnade added a comment - I created a mixin for the Palette component that fixes the issue until a real fix is released, feel free to use it.
        Jochen Kemnade made changes -
        Attachment palette-sorting-fix.zip [ 12446747 ]
        Jochen Kemnade made changes -
        Affects Version/s 5.2.0 [ 12314122 ]
        Environment affects 5.0.18 as well as 5.1.0.5 regardless of OS/browser affects 5.0.18 as well as 5.1.0.5 and current 5.2.0-SNAPSHOT regardless of OS/browser
        Jochen Kemnade made changes -
        Affects Version/s 5.2.2 [ 12315376 ]
        Affects Version/s 5.2.1 [ 12315230 ]
        Jochen Kemnade made changes -
        Affects Version/s 5.2.3 [ 12315474 ]
        Jochen Kemnade made changes -
        Affects Version/s 5.2.4 [ 12315557 ]
        Jochen Kemnade made changes -
        Affects Version/s 5.2.5 [ 12315565 ]
        Environment affects 5.0.18 as well as 5.1.0.5 and current 5.2.0-SNAPSHOT regardless of OS/browser affects Tapestry versions 5.0.x.x through 5.2.x regardless of OS/browser
        Jochen Kemnade made changes -
        Affects Version/s 5.3.0 [ 12316023 ]
        Environment affects Tapestry versions 5.0.x.x through 5.2.x regardless of OS/browser affects Tapestry versions 5.0.x.x, 5.2.x and the current 5.3 version regardless of OS/browser
        Howard M. Lewis Ship made changes -
        Affects Version/s 5.3 [ 12316024 ]
        Affects Version/s 5.3.0 [ 12316023 ]
        Howard M. Lewis Ship made changes -
        Assignee Howard M. Lewis Ship [ hlship ]
        Howard M. Lewis Ship made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 5.3 [ 12316024 ]
        Resolution Fixed [ 1 ]
        Hide
        Hudson added a comment -

        Integrated in tapestry-trunk-freestyle #580 (See https://builds.apache.org/job/tapestry-trunk-freestyle/580/)
        TAP5-835: Palette keeps resetting order of selected values on page reload

        hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1185427
        Files :

        • /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/palette.js
        Show
        Hudson added a comment - Integrated in tapestry-trunk-freestyle #580 (See https://builds.apache.org/job/tapestry-trunk-freestyle/580/ ) TAP5-835 : Palette keeps resetting order of selected values on page reload hlship : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1185427 Files : /tapestry/tapestry5/trunk/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/palette.js
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        833d 16h 30m 1 Howard M. Lewis Ship 18/Oct/11 00:08

          People

          • Assignee:
            Howard M. Lewis Ship
            Reporter:
            Jochen Kemnade
          • Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development