Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Sorting problems

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Sorting problems
Link Posted: 04-May-2006 11:32
there is still a bug in the sorting mechanism. It works fine if nodes are not expanded. However, as soon as I call ExpandAll for example, the TopNode is suddenly somwhere in the middle.
Link Posted: 11-May-2006 06:29
Debug sorting, probably IComparer compare node with nodes from another level or returns incorrect results.
Link Posted: 11-May-2006 12:28
Victor, when ExpendAll is called, no call to node comparer is made. Thus, there must be a bug in flygrid
Link Posted: 21-May-2006 22:01
... so what am I supposed to do about this?

Thanks,

Tom
Link Posted: 22-May-2006 12:31

when ExpendAll is called, no call to node comparer is made. Thus, there must be a bug in flygrid

But nodes sorted after sort order of some column is changed.
If you use ExpandAll after SortOrder changing nodes and their children are sorted.
Link Posted: 22-May-2006 20:44
[quote="NineRays"]

when ExpendAll is called, no call to node comparer is made. Thus, there must be a bug in flygrid

But nodes sorted after sort order of some column is changed.
If you use ExpandAll after SortOrder changing nodes and their children are sorted.


But not with the NodeComparer that I specified in ColumnSortOrderChanging. So, I ask again, what am I supposed to do about this?

        void PositionMonitorGrid2_ColumnSortOrderChanging(object sender, Column column, SortOrder value, ref bool sorted)
        {
            this.Rows.Items.Sort(new NodeComparerWithTopNode(column, value, accountNodeCache["TOTAL"]));

            sorted = true;
            this.Rows.RefreshNodes();
        }


Also, when I expand only one node and then sort a couple times, the top node gets mixed up sometimes as well
Link Posted: 22-May-2006 21:04
Use following code to provide IComparer:
[C#]
public class MyGrid : FlyGrid
{
   //....
  //override GetComparer method
  protected override IComparer GetComparer(Rows rows, Column[] sortColumns)
  {
    NodeBase accNode = accountNodeCache[\"TOTAL\"];
    if (accNode != null)
    {
      IComparer comparer = new NodeComparerWithTopNode(sortColumns, accNode);      
      return comparer;
    }
    return base.GetComparer(rows, sortColumns);
  }
}
Link Posted: 22-May-2006 21:38
thx, that does work