2 Replies Latest reply on Sep 8, 2007 12:47 PM by JazzyM

    sort buttons only works ones

    JazzyM
      Hi,

      I'm using an HorizontalList in my application to show some pictures.
      This list is using 'gallery.photos' as a dataprovider.
      'gallery' is an object, which contains the arraycollection 'photos', and that arraycollection contains several 'photo' objects.
      Now, I made some sort buttons/functions. At the end of these functions I use the 'gallery.photos.refresh();' command to update the dataprovider of the HorizontalList.
      No problem with that, but after I use a sort button I can't use any other sort buttons anymore (I can't click on the buttons), but I have no idea why.

      Here's an example of the functions I'm using:

      private function sortNaam():void
      {
      var sort:Sort = new Sort();
      sort.fields = [new SortField("naam",true,false)];
      gallery.photos.sort = sort;
      gallery.photos.refresh();

      }


      <mx:Button id="sorteerNaam" click="sortNaam();" label="Sorteer Naam"/>

      Then there's another problem: I made a sort button/function to sort the pictures by date (for example 05-08-07). The thing is: the pictures are allready sorted by date (the first picture has '05-08-07' as a date, the second picture '06-08-07' and so on) when the page is loaded (because that's the way they are sorted in the XML file), but when I push the 'sort by date' button the function sorts the pictures anyway and instead of being sorted in ascending order (even if they allready are sorted in ascending order) they are sorted in descending order (first 06-08-07, then 05-08-07).
      And this is happening even if the SortField order option is put on 'false'. This is the function I'm using:

      sort.fields = [new SortField("datum",true,true)];