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

How to make second column as hierarchical tree view column.

6 Answers 460 Views
GridView
This is a migrated thread and some comments may be shown as answers.
muralidhar
Top achievements
Rank 1
muralidhar asked on 07 Feb 2012, 12:44 PM

Hi,
I am displaying data in the grid as hierarchical form using a self reference, here treeview column is displayed in the first column as shown in attached screen shot1 but i need to display the treeview node in second column instead of first column as shown in attached screen shot 2. How can i achieve the output shown in screen shot 2?

Thanks..

6 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 09 Feb 2012, 12:08 PM
Hi muralidhar,

Thank you for writing.

This column is not a treeview column. The expander column is always at the beginning of the first column of the grid. In the mentioned example the borders between the expander column and the first column are removed and this creates an illusion that the expander is part of the column. Thus, the required functionality is not supported. 

I hope that you find this information useful. Let us know if you have any other questions.
 
Kind regards,
Stefan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
muralidhar
Top achievements
Rank 1
answered on 09 Feb 2012, 02:30 PM

Hi,

 

Thanks for your answer.

 

It’s a pitty this is not possible. We would like to have the first column as a “status” column which would indicate which status the item of that row has using an icon.

 

Since it’s not possible to do as we like, is it possible to show our “status” icon in the same column like the “treeview” column? But then the status icon should have to be shown before the expanding options (+ or -).

 

Is this possible?

 

Thanks,

0
Stefan
Telerik team
answered on 14 Feb 2012, 10:54 AM
Hi Muralidhar,

Thank you for writing back.

In this case, what you can do is have your images containing the expander item and hide the real expander item. Then when you click a cell, if it has ChildRows, we will expand/collapse it and the image will change. Attached you can find a sample project demonstrating how to hide the expander and how to set images for the different states. 

I hope that you find this useful.
 
Kind regards,
Stefan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Stefan
Telerik team
answered on 14 Feb 2012, 11:19 AM
A quick follow up. I have added a feature request in PITS according to your requirement. Here is a link to it: http://www.telerik.com/support/pits.aspx#/public/winforms/9734. Feel free to add your vote there. 

Your Telerik points have been updated for this request.
 
All the best,
Stefan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
muralidhar
Top achievements
Rank 1
answered on 14 Feb 2012, 11:28 AM

Hi,

 

Thanks for your answer. But this is not really what we want.

The order in our hierarchical column is like this:

Status icon  - + / - (to expand or collapse) – possible other icon – Name of item

For the moment we have this:

+ / - (to expand or collapse) – possible other icon – Name of item

So all we want to do is to add the status icon before the expanding / collapsing ‘button’.

Is this possible or not? Or do you have any other suggestions?

Thanks,

Muralidhar

0
Stefan
Telerik team
answered on 17 Feb 2012, 10:08 AM
Hello Muralidhar,

Thank you for the clarification.

In my last post I was suggesting combining your status image with the expander image the in this case you will have the desired layout. However, from your last post I can see that your requirement is a bit different. You want to have four different elements (Status + Expander + OtherIcon + ContentText). To do this, you need to create a CustomCell. Attached you can find a sample project, where I have implemented this requirement for you. Your cell contains of four different elements. The content element gets its value from the cell value (see SetContentCore method). Also, when the expanderIcon element is clicked, I am changing the row expanded state (see expanderIcon_Click event handler). 

The custom column is needed to make sure that your custom cell does not get reused in some of the other column. Also, if you need to make this cell editable, in the custom column file, uncomment the override of GetDefaultEditorType() method. 

In Form.cs, in the CellFormatting event handler, you can see how I am setting the different cell images. There is example for setting the status, expander and optional element image. 

Let me know how this works for you.
 
Greetings,
Stefan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
muralidhar
Top achievements
Rank 1
Answers by
Stefan
Telerik team
muralidhar
Top achievements
Rank 1
Share this question
or