This is a migrated thread and some comments may be shown as answers.

Template Column OrderIndex question

5 Answers 15 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Thomas Yanez
Top achievements
Rank 1
Thomas Yanez asked on 15 May 2019, 08:17 PM

I've just started working with RadTreeList, and have spent most of my day looking for info that covers my problem but cannot find it.  I have followed many links that end up just taking me back to the base description of functionality without answering the actual question I have. 

 

I have a RadTreeList that is auto-generating a number of columns (this is working fine).  I also have a template column defined in the markup that adds a combo box to each row of the RadTreeList (this is also working fine.)  That template column is being inserted as the first column in the tree (expected) but I want it to be the last.  My question is this : how do I make that happen?  Is there any way to change the .OrderIndex on the column, either to otherwise have it be added after the auto-generated columns?  If not, is there a way to programatically change the order (shift the column to the end) after the RadTreeList has been built without having to write code that swaps the column down the line? Is the solution here to just not create the template column at design time and build it dynamically (including the work that goes along creating my own template class, etc)?

 

Any guidance would be greatly appreciated.

5 Answers, 1 is accepted

Sort by
0
Accepted
Vessy
Telerik team
answered on 20 May 2019, 11:33 AM
Hi Thomas,

Setting the OrderIndex value of the created template column to a value bigger than the total columns count will place the column in the last position:
https://docs.telerik.com/devtools/aspnet-ajax/controls/treelist/column/reordering#reordering-columns-programmatically

For example:
TreeListTemplateColumn dynamicColumn = new TreeListTemplateColumn();
....
RadTreeList1.Columns.Add(dynamicColumn);
dynamicColumn.OrderIndex = 100;


Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Thomas Yanez
Top achievements
Rank 1
answered on 20 May 2019, 02:14 PM
Thank you for the answer.  I didn't bother trying that because the documentation specifically says that you cannot have gaps in the .OrderIndex values.  Your solution worked fine.
0
Vessy
Telerik team
answered on 21 May 2019, 10:23 AM
Hi,

You are welcome, Thomas - I am glad everything is working as desired now.

Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Thomas Yanez
Top achievements
Rank 1
answered on 21 May 2019, 11:50 AM

Thanks again.  For future reference, though, you might consider updating the info found here :

https://docs.telerik.com/devtools/aspnet-ajax/controls/treelist/column/reordering

You'll note that at the bottom, there is an explicit warning, with a red exclamation point and a reddish background that says that you cannot omit any index values.  I interpreted that to mean that you could not have any gaps in the indices assigned, so I didn't try just reassigning the design-time columns to arbitrarily high values.

0
Vessy
Telerik team
answered on 23 May 2019, 03:35 PM
Hi,

Thanks a lot for the feedback, Thomas - we will review the linked article and will try to describe in more details in which scenarios these settings are mandatory.

Regards,
Vessy
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TreeList
Asked by
Thomas Yanez
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Thomas Yanez
Top achievements
Rank 1
Share this question
or