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

Custom aggregators

3 Answers 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Stefania
Top achievements
Rank 2
Stefania asked on 31 Oct 2018, 04:22 PM

Hi,

I would like to create two generic custom aggregators as like your CounterFunction class with the following differences

1st aggregator: it should count only not null value and not the empty strings

2nd aggreagator: it should count the distinct values (example: a a a b b c -> count =3 )

 

Any idea?

Thank you

3 Answers, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 01 Nov 2018, 03:51 PM
Hello Stefania,

You should be able to achieve what you are going for with a custom aggregate function. May I ask you to take a look at the Custom Aggregate Function RadGridView example from our demos

Please, give the approach demonstrated in that example a try and let me know how it goes.

Regards,
Vladimir Stoyanov
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.
0
Stefania
Top achievements
Rank 2
answered on 05 Nov 2018, 08:48 AM

Hello Vladimir,

thank you for your reply.

Yes, I saw the demos and I already implemated that on my application in a specific case.

The difference betwwen your demos and what I would like to do is to use a generic classes not a specific one

I have to use this custom aggregator in a lot of grids so it has to be a generic. I will have a different classes and properties.

 


0
Vladimir Stoyanov
Telerik team
answered on 07 Nov 2018, 11:43 AM
Hello Stefania,

An idea that comes to mind is to make the generic function's argument -> object instead of a specific type. This way you will be able to use the aggregate function with different types.

However, if you need to access different properties of those objects, another approach would be to define an interface which all of your custom types will implement. That interface can expose a single property which will be checked inside the AggregateFunction and the different types will return their respective properties in the interface's implementation. I hope that such an approach would be applicable in your scenario. 

Hope you find this helpful.

Regards,
Vladimir Stoyanov
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.
Tags
GridView
Asked by
Stefania
Top achievements
Rank 2
Answers by
Vladimir Stoyanov
Telerik team
Stefania
Top achievements
Rank 2
Share this question
or