Heirarchical Virtual Grid with Multiple Distinct Children?

6 posts, 0 answers
  1. Michael
    Michael avatar
    3 posts
    Member since:
    Apr 2016

    Posted 08 Nov 2018 Link to this post

    Hi, 

     

    The ability to add a heirarchy to the parent rows in the virtual grid is great, but is there a way to add multiple data types for the children rows?

     

    For example 

     

    public class Parent{

    public string Name = "Parent Row";

    public ChildType1 child1 = new Child1();

    public ChildType2 child2 = new Child2();

     

    }

     

    When a user expands the Parent row, is there a way to define new grids for both Child1 and Child2 to be expanded?  This would be super helpful for an asset management project I'm working on. 

     

    Thanks,

    Mike

     

     

     

  2. Hristo
    Admin
    Hristo avatar
    1519 posts

    Posted 09 Nov 2018 Link to this post

    Hi Michael,

    Upon expanding the parent row it is necessary to define the row and column count of the child view as it is demonstrated here: https://docs.telerik.com/devtools/winforms/virtualgrid/hierarchical-virtual-grid/hierarchical-data. The virtual grid does not support multiple child views. As you are having different objects you can display all of the fields of your object as columns. Then you can handle the CellValueNeeded event depending on the column index/name display the data. This way you will have both of the objects displayed in the child view.

    I hope this will help. Let me know if you have other questions.

    Regards,
    Hristo
    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.
  3. Michael
    Michael avatar
    3 posts
    Member since:
    Apr 2016

    Posted 05 Dec 2018 in reply to Hristo Link to this post

    How would one go about displaying another rad gridview as an object within a grid view table cell?  

     

    For example, is it possible to have 

     

    class TestObject{

    public RadVirtualGrid DisplayMe {get;set;}

    }

     

    and have the RowExpanding call display the RadVirtualGridand not the "ToString()" representation of DisplayMe?  I see a way to do it with an Image, but how would I embed another RadVirtualGridwithin a cell?  Is this possible?

     

    I'm trying to have uses click different columns and have different objects display so why not just simplify the process and have every expandable object display a RadVirtualGrid and have the parent row only need to deal with the behavior of that control?

     

    Thanks,

    Mike

  4. Hristo
    Admin
    Hristo avatar
    1519 posts

    Posted 06 Dec 2018 Link to this post

    Hi Michael,

    Thank you for writing back.

    The virtual grid does not support multiple views defined for the same level. However, the control supports different templates for each of the parent rows. In other words, this means that you can display a completely different set of columns for each of the expanded parent rows. Depending on your actual scenario, you will need to handle the RowExpanding event and defined the column and row count values for each expanded rows. Then in the CellValueNeeded event, you can display the correct data according to the template and the parent row.

    I am sending you attached my test project where depending on the row index of the parent row I am displaying different child templates. I hope this will help.

    Regards,
    Hristo
    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.
  5. Michael
    Michael avatar
    3 posts
    Member since:
    Apr 2016

    Posted 06 Dec 2018 in reply to Hristo Link to this post

    Hi Hristo,

     

    I have been able to successfully make a similar project, but what I'm trying to do is have a virtual grid that shows a few different data types which may or maybe not have sub grids.

    Think of it this way:

    Class BaseRow{

    public int ID {get;set;}

    public SubRowTypeOne SubOne {get;set;} = new SubRowTypeOne();

    public SubRowTypeTwo SubTwo {get;set;} = new SubRowTypeTwo();

    }

     

    public class SubRowTypeOne{

    public int ID {get;set}

    public string MetaData {get;set;}

    public SubRowTypeThree SubThree {get;set;} = new SubRowTypeThree();

    }

    public class SubRowTypeTwo{
    public int ID {get;set}
    public string MetaData2 {get;set;} = "Test1";

    public string MetaData3 {get;set;} = "Test2";

    }

    public class SubRowTypeThree{

    public int ID{get;set;}

    public string MetaData {get;set;} = "Test3";

    }

     

    List<BaseRow> BaseList = new List<BaseRow>();

    BaseList.Add(new BaseRow(){ID =1});

    BaseList.Add(new BaseRow(){ID = 2});

     

     

    What I'm trying to achieve is where a cell click even triggers expansion of different sub objects, which I've achieved, but the issue is when I go to collapse the row containing the sub object, 

    So imagine a BaseRow is displayed and a user clicks the SubRowOne object, then that expands, shows 1 row and then the user clicks the SubRowThree object, and that expands - you will have two sub rows open.  Then the user goes to click the base row and moves to the SubRowTwo object. When I collapse the row for the initial expansion the grid view thinks that the SubRowThree object still exists and creates SubRows based on that, so how do I reset that behavior?  Basically once you expand a row, the sub data seems to be cached by the virtual grid, which is great for congruent data types, but what if I am using different data types ?

     

     

    Mike

     

     

     

     

     

     

     

     

     

  6. Hristo
    Admin
    Hristo avatar
    1519 posts

    Posted 07 Dec 2018 Link to this post

    Hello Michael,

    The suggested approach in the project from my previous posts suggests a way to display different data in each of the child rows. I am not sure how to observe the reported on your end behavior. Please consider opening up a support ticket and sending us your project so that we can investigate it.

    Regards,
    Hristo
    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.
Back to Top