0

I'm trying to create a grid using a winTree (UltraNode) that's sortable, I create this programaticly, add the columns and nodes by code. When displaying the grid I'm able to sort by the alphabetical columns, but the Id and another field that are numerical aren't sorted.

A simplification of what I'm doing would be:

var tree = new UltraTree();

tree.override.ColumnSet.Columns.Add(new UltraTreeNodeColumn{text = "Name"});

tree.override.ColumnSet.Columns.Add(new UltraTreeNodeColumn{text = "Id"});

var treeNode1 = new UltraTreeNode();

treeNode1.Cells["Name"].Value = name1;

treeNode1.Cells["Id"].Value = Id1;

tree.Nodes.Add(treeNode1);

var treeNode2 = new UltraTreeNode();

treeNode2.Cells["Name"].Value = name2;

treeNode2.Cells["Id"].Value = Id2;

tree.Nodes.Add(treeNode2);

When viewing the grid, I can sort the alphabetic values using the column header, but when I click the Id header there's no sorting.

Thanks

evilpilaf
  • 1,991
  • 2
  • 21
  • 38
  • What is the type for Id1 and Id2? If they are your type then you may need to specify a SortComparer on the Column: http://help.infragistics.com/NetAdvantage/WinForms/Current/CLR4.0/?page=Infragistics4.Win.UltraWinTree.v12.2~Infragistics.Win.UltraWinTree.UltraTreeNodeColumn~SortComparer.html – alhalama Mar 25 '13 at 15:51
  • @alhalama thanks but I already trued that and had no efect – evilpilaf Mar 26 '13 at 19:35
  • So what are Id1 and Id2? Are you using a custom type, are these integer variables? – alhalama Mar 27 '13 at 22:38

2 Answers2

0

Try to add the datatype to that column

tree.Override.ColumnSet.Columns.Add(new UltraTreeNodeColumn
                                    {Text = "Id", DataType = typeof(Int32)});
Steve
  • 213,761
  • 22
  • 232
  • 286
  • still nothing... I just don't understand how the alphabetic sorting works and the numerical doesn't, within the same control... – evilpilaf Mar 26 '13 at 20:45
  • if you have a resulted sort like this 1, 10, 11, 2, 21, 3 it is because the column is considered alphabetic and not numeric. – Steve Mar 26 '13 at 20:47
0

Turns out the grid was grouping the results, so the ids where ordered, but first grouped by the elements they belonged to

evilpilaf
  • 1,991
  • 2
  • 21
  • 38