In this case you can use custom sorting:
[c#]
private void InitFlyGrid()
{
//...do something...
// connect to ColumnSortOrderChanging event handler
this.flyGrid.ColumnSortOrderChanging += new ColumnSortOrderChangingHandler(flyGrid_ColumnSortOrderChanging);
}
//custom comparer
public class NodesComparer : IComparer
{
private SortOrder order;
private Column col;
public NodesComparer(Column col, SortOrder order)
{
this.col = col;
this.order = order;
}
#region IComparer Members
public int Compare(object x, object y)
{
Node xnode = x as Node;
Node ynode = y as Node;
int result = 0 ;
object xobj = xnode.GetCellValue(col);
object yobj = ynode.GetCellValue(col);
IComparable xvalue = xobj as IComparable;
IComparable yvalue = yobj as IComparable;
if (xvalue != null && order == SortOrder.Ascending)
{
result = xvalue.CompareTo(yvalue);
}
else if (yvalue != null && order == SortOrder.Descending)
{
result = yvalue.CompareTo(xvalue);
}
return result;
}
#endregion
}
//ColumnSortOrderChanging event handler
private void flyGrid_ColumnSortOrderChanging(object sender, Column column, SortOrder value, ref bool sorted)
{
if (column is HierachyColumn)
{
FlyGrid fg = sender as FlyGrid;
fg.Rows.Items.Sort(new NodesComparer(column, value));
fg.Rows.RefreshNodes();
sorted = true;
}
}