How to make second column as hierarchical tree view column.

7 posts, 0 answers
  1. muralidhar
    muralidhar avatar
    12 posts
    Member since:
    Jan 2011

    Posted 07 Feb 2012 Link to this post

    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..

  2. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 09 Feb 2012 Link to this post

    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 >>
  3. muralidhar
    muralidhar avatar
    12 posts
    Member since:
    Jan 2011

    Posted 09 Feb 2012 Link to this post

    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,

  4. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 14 Feb 2012 Link to this post

    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 >>
  5. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 14 Feb 2012 Link to this post

    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 >>
  6. muralidhar
    muralidhar avatar
    12 posts
    Member since:
    Jan 2011

    Posted 14 Feb 2012 Link to this post

    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

  7. Stefan
    Admin
    Stefan avatar
    2908 posts

    Posted 17 Feb 2012 Link to this post

    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 >>
Back to Top