We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to calculate a group summary based on a parent group

Hi,

How can I implement a custom group summary that performs a calculation based on the parent group? ISummaryAggregate's CalculateAggregateFunc() only provides the records in the current group, and there does not appear to be a way to access the parent group.

 

Thanks.

 

---

Richard


1 Reply

GA Gobinath A Syncfusion Team September 10, 2013 09:44 AM UTC

Hi Richard,

Thanks for your patience.

We can get the parent record in the following Highlighted code in the CalculateAggregateFunc() method and you have to calculate the child group record also in the below method.

Code snippet[C#]:


public Action<System.Collections.IEnumerable, string, System.ComponentModel.PropertyDescriptor> CalculateAggregateFunc()

{

  return (items, property, pd) =>

   {

     var enumerableItems = items as IEnumerable<Data>;

     if (pd.Name == "Price")

      {

       this.Price = enumerableItems.CountTo<Data>(q => q.ProductPrice);

      //We can get the child record in the below line of code

    //  this.ChildPrice = enumerableItems.CountToParent<Data>(q => q.Collection[i].ProductPrice);

      }

    };

}

For your reference we have attached simple sample and please find the sample under the following location.

Sample: NestedWithObserveCollection.zip

 

Please let us know if you have any queries.

Regards,

Gobinath A


Loader.
Live Chat Icon For mobile
Up arrow icon