Hello, I want to make custom summaries with different "operate" methods, depending on a variable. Something like this:
But the variable is not defined inside the "operate" method, is defined somewhere else. I've tried several approaches but none worked.Is there any way possible to do this?Thanks
Hello Gabriel,
I am glad that you find this suggestion and sample helpful.
Thank you for using Infragistics components.
Hello Desislava, the sample fulfilled my use case,Thanks!
Hello Gabriel,Thank you for the provided sample.I investigate your use case in more details and managed to build you the following sample. Here you can see how you can pass a service to the custom summary class and also one way to set a variable which can be used in the operate method. The custom summary class is applied to Units In Stock column and you can enable summary for that column with button. Please take a look at the sample and see if it fulfill your use case.If you have any additional questions, please contact us.
Hello Martin,I've added some comments explaining what I'm trying to achieve in this sample.I've tried some different solutions, but none worked. Defining a static variable inside MySummary class wouldn't work because the 'operate()' method is not in a static context. Defining the variable 'types' to be received in the constructor wouldn't work because MySummary class is not instantiated. Other approaches that I've thought wouldn't work because of the lifecycle of the component.What I'm trying to do is making the content of summaries (sum, count, avg...) not dependent on the 'dataType', it would be dependent on the 'types' variable instead.I expect that with this answer I could make you understand what I'm trying to achieve.
Thanks
Thank you for posting in our community.
Can you please clarify what are you trying to achieve?
I have created a sample in StackBlitz based on the provided screenshot. Please fork it, modify it to meet your requirement(despite of the errors that may occur) and share the link.