Home - Forums-.NET - FlyGrid.Net (Windows Forms) - What is the underlying object for a row/node?

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

What is the underlying object for a row/node?
Link Posted: 14-Nov-2005 07:23
I'm a little confused about the difference between a node and a row in the workings of the FlyGrid.

To be specific, I have a grid with the first column being a treeview presentation of nodes.  I have added additional columns (in the designer) and have put in a field name for these columns.  Is there an underlying "object" for each row to which these columns are bound or will look for the field name?

For example, assume I had a Person object with name, age and married properties, and I arranged them according to family tree:

Name                   Age      Married
- Bob                    80          X
   - Dan                 50          
   - Sally                45          X
         - Berty         20    
         - Elmer         21         X
         - Duncan      18        
   - Missy                38        
         - Peter          8          
   - Bob Jr.              51          X

The object[] param of the node constructor in your example seems to just be an array of values to populate the nodes.  I guess I can do it this way, but it seems there might be some way to ave the grid do the work for me...
Link Posted: 14-Nov-2005 07:26
Looks like the white space was stripped on my tree example (I put in ... to hold space:

Name Age Married
- Bob ............80 ..X
- - Dan .........50
- - Sally ........45 ..X
- - - Berty .....20
- - - Elmer ....21 ..X
- - - Duncan .18
- - Missy .......38
- - - Peter ......8
- Bob Jr. .......51 ..X
Link Posted: 14-Nov-2005 09:55
Underlying object for the node/row represented as array of objects that will displayed as array of cells:
for example, to show this structure:

Name Age Married
- Bob ............80 ..X
- - Dan .........50
- - Sally ........45 ..X
- - - Berty .....20
- - - Elmer ....21 ..X
- - - Duncan .18
- - Missy .......38
- - - Peter ......8
- Bob Jr. .......51 ..X


you should use following code:

//first level
TreeViewNode bob = new TreeViewNode(new object[]{"Bob", 80, true});
TreeViewNode bobJr = new TreeViewNode(new object[]{"Bob Jr.", 51, true});

//second level
TreeViewNode dan = new TreeViewNode(new object[]{"Dan", 50, false});
TreeViewNode sally = new TreeViewNode(new object[]{"Sally", 45, true});
TreeViewNode missy = new TreeViewNode(new object[]{"Missy", 38, false});
//third level
TreeViewNode berty = new TreeViewNode(new object[]{"Berty", 20, false});
TreeViewNode elmer = new TreeViewNode(new object[]{"Elmer", 21, true});
TreeViewNode duncan = new TreeViewNode(new object[]{"Duncan", 18, false});
//add to Sally
sally.Items.AddRange(new NodeBase[]{berty, elmer, duncan});

TreeViewNode peter = new TreeViewNode(new object[]{"Peter", 8, false});
//add to Missy
missy.Items.Add(peter);
//add to Bob
node1.Items.AddRange(new NodeBase[]{dan, sally, missy});
//add first level node to FlyGrid
flyGrid.Rows.Items.AddRange(bob, bobJr);