I've got a class that looks like this:
public class GeneralStatusInfo { public List<string> List_BLNumber { get; set; } public List<POInfo> List_PONumbers { get; set; } public List<string> List_Pickup { get; set; } public List<string> List_Origin { get; set; } public List<string> List_Destination { get; set; } public List<string> List_NotifyName { get; set; } public List<AppmntInformation> List_Appointments { get; set; } }
When I bind the data like this:
List<GeneralStatusInfo> statusBind = new List<GeneralStatusInfo>(); statusBind.Add(status); utGeneralStatusInfo.DataSource = statusBind; SetupTree(status);
It puts my parent nodes in a different order:
Appointment P/O Number B/L Number Origin Pickup Notify Payment Destination
How do I reorder the nodes so they appear in the same order that I have them in my class?
Hi,
I'm not sure I understand what you are asking. Are you talking about the order of the nodes in the tree or the order of the columns? You said "parent nodes", but theres nothing in your post about the order of the nodes, just the columns.
If it's the columns, then the order is determined by the DotNet BindingManager. It gets the order by calling GetPropertyDescriptors on the ITypedList implementation of the data source. So the order is pretty much arbitrary unless you implement ITyledList yourself and return the property descriptors in the order you want.
Assuming you are letting the tree automatically generate the ColumnSets (which is the default), you can change the order of the columns in the tree by handling the ColumnSetGenerated event and setting the OriginX on each column:
e.ColumnSet.Columns["Column A"].LayoutInfo.OriginX = 0;
e.ColumnSet.Columns["Column B"].LayoutInfo.OriginX = 1;
etc.
I
I tried setting the columnset origin, but that did not work. Basically each of the "parent nodes" are lists and each of the "child nodes" are also lists. The way that they are defined in the class are in my post above. I am needing "Destination" to be above "Payments".
I'm confused. I thought you said you tried my suggestion of setting the OriginX on each column and it didn't work?
The code you posted here is not setting anything that would affect the column order.
In fact, you are only handling the child ColumnSet for the "List_Appointments" node. You need to handle the root ColumnSet which contains those Band nodes and each node will be represented by a column in the ColumnSet.
Thanks as always, Mike.
I am still confused on this... The only thing I am currently using the ColumnSetGenerated event for is setting the widths of the columns and the header text... a sample is below. Other than that, I can't seem to find out how to still reorder the parent nodes. Below is also an expanded version (after reenabling the expansion indicators of the lists with just one column/entry). Maybe this can help better explain what is going on.
private void utGeneralStatusInfo_ColumnSetGenerated(object sender, ColumnSetGeneratedEventArgs e) { switch (e.ColumnSet.Key) { case "List_Appointments": //Sets the labels for each column e.ColumnSet.Columns["NotifyDate"].Text = "Notify\r\nDate"; e.ColumnSet.Columns["PostedDate"].Text = "Posted\r\nDate"; e.ColumnSet.Columns["PostedTime"].Text = "Posted\r\nTime"; e.ColumnSet.Columns["AppointmentDate"].Text = "Appt\r\nDate"; e.ColumnSet.Columns["AppointmentBegTime"].Text = "Beg\r\nTime"; e.ColumnSet.Columns["AppointmentEndTime"].Text = "End\r\nTime"; e.ColumnSet.Columns["AddedUserID"].Text = "INT"; e.ColumnSet.Columns["KeyingCRT"].Text = "CRT"; e.ColumnSet.Columns["NotifyName"].Text = "Name"; e.ColumnSet.Columns["PhoneNumber"].Text = "Contact\r\nPhone #"; //Sets the initial column width for each column e.ColumnSet.Columns["NotifyDate"].LayoutInfo.PreferredLabelSize = new Size(85, 0); e.ColumnSet.Columns["AddedUserID"].LayoutInfo.PreferredLabelSize = new Size(100, 0); e.ColumnSet.Columns["NotifyName"].LayoutInfo.PreferredLabelSize = new Size(100, 0); e.ColumnSet.Columns["PhoneNumber"].LayoutInfo.PreferredLabelSize = new Size(200, 0);
Can you post the code you used to arrange the order of the nodes?
These nodes you have here appear to be band nodes. These are nodes that represent child lists of data. There should be a column in the ColumnSet for each child band and each of these columns will have the IsChaptered property set to true. These are the columns you need to re-order.
I think there might have been a bug in an old version of the tree where the tree was not honoring the order for these band node columns. So it's possible you may need to get the latest service release in order for this to work.
How to get the latest service release - Infragistics Community