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

How do I Aggregate this?

4 Answers 84 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kennet
Top achievements
Rank 2
Kennet asked on 10 Jul 2010, 09:17 AM
I have a simple collection with: name, title, category, position. I want all with category=1 Aggregated, but in the order then come in the collection always sorted on "position". And I want no Aggregation on Category=0.  I also ned in the custom header for "Category=1", how many items there are in that segment

Or should I do this by Hierarchy?  This is a n Example wo the grid should look like. 

"Name", "Title", "Cat", "Pos"  (>--  is the aggregated rows)

Name 1, Title 1, 0, 0
Name 2, Title 2, 0, 1
Name 3, Title 3, 0, 2
>-- Name 4, Title 4, 1, 3
>-- Name 5, Title 5, 1, 4
>-- Name 6, Title 6, 1, 5
Name 7, Title 7, 0, 6
Name 8, Title 8, 0, 7
Name 9, Title 9, 0, 8
>-- Name 10, Title 10, 1, 9
>-- Name 11, Title 11, 1, 10
Name 12, Title 12, 0, 11


/Ken

4 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 14 Jul 2010, 09:10 AM
Hi Kennet,

That would be impossible. Aggregation has its basic principles and logic and they cannot be arbitrarily modified in order to satisfy a custom, non-standard scenario.

You cannot do this with Hierarchy either, unless Names 4, 5, and 6 are child records of Name 3, which I seriously doubt.

Thank you for your understanding.

Sincerely yours,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kennet
Top achievements
Rank 2
answered on 14 Jul 2010, 03:26 PM
Thanks Ross.

I have experimented with your exaple code "Custom Hierachy"  and to get the "+" I use "IsExpandable"  on "RowLoaded"  that works fine.

But I want to fill the "child grid" with data from a SQL query based on the row expanded. I tested on "DataLoading" and get the data from "ParentRow.DataContext", but I cant fill the child grid.

How du I fill the childgrid with other data than main grid has?

/Ken

0
Rossen Hristov
Telerik team
answered on 14 Jul 2010, 04:09 PM
Hi Kennet,

I see what you mean. In this case it will be much easier if you use the Row Details feature. It has events such as LoadingRowDetails (fired only the first time a detail is ever expanded) and RowDetailsVisibilityChanged (fired each time a details is being expanded/collapsed). Everything is explained in the documentation topic.

So you can place an unbound RadGridView in the row details template. Then attach to one of those events depending on your needs. In the event argument you have e.DetailsElement, which will be your child RadGridView (or in other words -- the thing that you have placed in the row details template). You can cast it to RadGridView and set its ItemsSource to whatever you need. Remember, the DataContext of this child RadGridView will be the parent row's data item, so that you have this information as well.

Here is an example of row details.

I also have several blog posts with sample projects that utilize row details:
How To: Display Hierarchical Data with Row Details (RadGridView for Silverlight)

Asynchronous Master-Details with RadGridView for Silverlight and WCF RIA Services -- this one does something similar to what you are trying to achieve.

Master-Details with RadGridView for Silverlight 4, WCF RIA Services RC2 and Entity Framework 4.0

I hope this helps.

Best wishes,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Kennet
Top achievements
Rank 2
answered on 14 Jul 2010, 04:33 PM
RowDeitals may be the way to go. Thanks Ross, I will have a look at that.

BTW, I did manage to load data by setting my datacollection to "e.ItemsSource" in "_DataLoading".

/Ken
Tags
GridView
Asked by
Kennet
Top achievements
Rank 2
Answers by
Rossen Hristov
Telerik team
Kennet
Top achievements
Rank 2
Share this question
or