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

flat hierarchy style on childtable of a gridview

4 Answers 112 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Emanuel
Top achievements
Rank 1
Emanuel asked on 11 Jun 2012, 12:29 PM
Hello out there

I'm just working on a report table, which should list my materials and all materials below one.
To display the data, I'm using the gridview with the childtemplate things.
This is working without problems but I want to use a flat hierarchy style instead of the default one.
So it should look like this

                  Cost       Type
Parent          x              x
Child            x              x
Child-child    x              x

I really don't know how to do this.
Hope you can help me.

Thanks in advance!
Greetings
Emanuel

4 Answers, 1 is accepted

Sort by
0
Accepted
Vlad
Telerik team
answered on 11 Jun 2012, 12:33 PM
Hi Emanuel,

Maybe the best way will be to create a view-model with a collection representing both parent and child data at once and bind the grid to this collection. 

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Emanuel
Top achievements
Rank 1
answered on 11 Jun 2012, 12:56 PM
Hey Vlad 
Thank you for the fast answer.
I was also thinking about this, but then I'll lose the possibility to expand/collapse the child elements.
Is your solution just the easiest one, or is there simply no other possibility to solve this?
Would be great to have such a feature. Maybe in the next release ;)
Anyway thanks again!
Regards,
Emanuel
0
Accepted
Vanya Pavlova
Telerik team
answered on 11 Jun 2012, 01:17 PM
Hi Emanuel,


You may predefine the template of GridViewRow and remove the default Padding of 6 pixels around PART_HierarchyChildPresenter. Through removing the rowindicators of the child grids you will have aligned grids in this scenario. Please check the attached project and let me know how this works for you! 



Greetings,
Vanya Pavlova
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Emanuel
Top achievements
Rank 1
answered on 11 Jun 2012, 02:07 PM
Hi Vlad

This worked for me thanks.
But I found out, I could use TreeListView to display the data :)
So I will try also this one.

Regards
Emanuel
Tags
GridView
Asked by
Emanuel
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Emanuel
Top achievements
Rank 1
Vanya Pavlova
Telerik team
Share this question
or