How to order the columns in a WinTree?

rated by 0 users
This post has 6 Replies | 5 Followers

Not Ranked
Points 295
spm Posted: 12-26-2007 8:44 AM

Hi,

       I have bound WinTree to a DataTable having multiple columns and I want to reorder the positioin of columns appearing in the Tree.  The order of columns should be possible to change in the run time (not by user drag drop).  I was looking for properties like VisibleHeaderPosition, but was unable to find.  How to achieve this functionality? Please suggest. 

Regards,

spm

 

  • | Post Points: 35
Not Ranked
Points 332

Look under the properties panel of your ultraWinTree for ColumnSettings ->> ColumnSets ->>

From there, click the (...), and you should see the "UltraTreeColumnSet Collection Editor"

Select (from the left) the band of data you wish to modify the columns for. Then on the right, scroll down to the property called "Columns" and click on the (...).

Here you should see the "UltraTreeNodeColumn Collection Editor", and by using the up and down arrows, you should be able to change the order of the columns.

I understand you're looking for something which works in run-time; and i'm sure this is the head-start you were looking for.

regards,

-kel-

  • | Post Points: 35
Not Ranked
Points 295

Hi Kel, 

Thanks for your reply.

It is very strange that WinTree does not have VisiblePosition propery which is present in the UltraGrid and it is very useful funtionality.  Since the index position of the column is what drives the display position, I thought perhaps Remove and InsertAt methods could be used to modify the index of the Column in the tree, but unfortunatley InsertAt method seems to be missing in the column collection object! (i.e., columnSet.Columns)

However there is round about approach to tackle this problem.  In my scenario there is a datatable which contains information about how the columns in the tree should be positioned, in the sample code below the column formatting information is fetched in the ascending order of position column (which is the desired display order) and is looped through to reset the index.......

            DataRow[ colCustomDetailRows = dataTable.Select("VisiblePosition ASC");
            int position = 0;          
            string columnName = string.Empty; 
            UltraTreeNodeColumn nodeColumn = null;
            foreach (DataRow dataRow in colCustomDetailRows) {
                columnName = dataRow["ColumnName"].ToString();
                nodeColumn = columnSet.Columns[;
                columnSet.Columns.Remove(nodeColumn);//remove the column from collection
                columnSet.Columns.Add(nodeColumn);//re-insert at the last position-once the looping is complete columns will be re-ordered correctly
                position++;
            }

Hope this will be helpful. 

Regards,

spm

  • | Post Points: 5
Not Ranked
Points 20

I suggest trying the Column.LayoutInfo.OriginX property.  This is related to SpanX property.

  • | Post Points: 20
Not Ranked
Points 170

Hi,

How can we reoder the column of a columnset, so that to add an unbounded column at the begining of the row of columns. 

I have checked the OriginX property does not provide correct information for columns (order, position) at the time of columnset generated or initalize data node events.   

Please suggest how can we acheive it.

regards
Vivek Bahl

 

       

  • | Post Points: 20
Top 10 Contributor
Points 46,465
Infragistics Employee

UltraTree uses the layout manager support that is built into the Infragistics framework; admittedly, some have found this to be difficult to use although it does offer a great deal of flexibility. UltraGrid's VisiblePosition property predates the layout manager support that was added to UltraGrid since its original release, but since UltraTree only uses the layout manager support, the VisiblePosition property (and Width property, on a related note) were not added.

The reason the OriginX property is not set is because by default, the ordinal position of the column within its Columns collection is used. What you can do to change this is handle the ColumnSetGenerated event, which gives you the UltraTreeColumnSet being generated, and explicitly set the UltraTreeNodeColumn.LayoutInfo.OriginX property on each member of the Columns collection; this is the equivalent of setting the VisiblePosition property of an UltraGridColumn. Note that the UltraTreeNodeColumn.LayoutInfo equivalent of the Width property is PreferredLabelSize.Width (or PreferredCellSize.Width if headers are not being displayed).

  • | Post Points: 5
Not Ranked
Points 25

 I have 2007 vol 2 clr 2.0

 

I tried the above and it leads me to a blank list.  I created the treeview, clicked on Nodes and added my nodes there.  I'm trying to change the order of the Nodes at design time, not run time and I seem to be missing how to do this.  Any help would be great. 

  • | Post Points: 5
Page 1 of 1 (7 items) | RSS

Forum Statistics

40,788 users have contributed to 129,818 threads and 144,150 posts.

In the past week, we've had 5,587 new users, adding to our total of 467,632 registered users!

In the past 24 hours, we have 56 new thread(s), 217 new post(s), and

In the past 3 days, the most popular thread for everyone has been "Google Chrome & UltraWebGrid. Compatible or Not? ". The post with the most views is "In wingrid RowFilter dropdown items for DropDown column is not shwing ". The most replies were made to "Google Chrome & UltraWebGrid. Compatible or Not? ".

Please welcome our newest member fceskxv .