Uploaded image for project: 'Tapestry 5'
  1. Tapestry 5
  2. TAP5-835

Palette keeps resetting order of selected values on page reload

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 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
    • 5.3
    • tapestry-core
    • None
    • 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()

      Attachments

        1. palette-sorting-fix.zip
          0.8 kB
          Jochen Kemnade

        Activity

          People

            hlship Howard Lewis Ship
            jkemnade Jochen Kemnade
            Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: