2 Replies Latest reply on Oct 16, 2007 8:02 AM by peewee64

    wrong sort order in datagrid sorting multiple columns


      I'm a little confused about sorting multiple columns in a datagrid. The following code does some sorting, but not the sorting, I would expect or what do you thing about a alphabetical order of O coming before M or after P . In my opinion the code should sort stadt, name, vname clicking on the column stadt and name,vname clicking on the column name, but obviously it does not do it correctly? Can you see any mistake in the code or is it a bug?

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="vertical">
      import mx.collections.SortField;
      import mx.collections.Sort;
      import mx.collections.ArrayCollection;
      import mx.events.DataGridEvent;
      var myData : ArrayCollection = new ArrayCollection(new Array(
      function mySort(event:DataGridEvent){
      var mySorter : Sort = new Sort();
      switch (event.columnIndex){
      case 1:
      mySorter.fields = [
      new SortField("name",true),
      new SortField("vname",true)
      case 3:
      mySorter.fields = [
      new SortField("stadt",true),
      new SortField("name",true),
      new SortField("vname",true)
      myData.sort = mySorter;
      <mx:DataGrid dataProvider="{myData}" headerRelease="mySort(event)">
      <mx:DataGridColumn dataField="name" headerText="Name" />
      <mx:DataGridColumn dataField="vname" headerText="Vorname" sortable="false"/>
      <mx:DataGridColumn dataField="stadt" headerText="Stadt" />