Hi!
Context: I am currently working on a project that is using WebHierarchicalDataGrid (ig v18.1), I was asked to add the summary "sum" for TimeSpan dataType Columns. This columns are added dynamically.
Now, yes, I currently know that sum only works for numerical types, so I decided to create a Custom Summary. I should be easy.
Everything was going empirically well. Until I realize that for some reason It seems that it is not the same process for adding a custom summary for WebDataGrid and for WebHierarchicalDataGrid.
I am expecting that a custom summary for WebHierarchicalDataGrid would behave like the example for WebDataGrid (https://es.infragistics.com/samples/aspnet/data-grid/summaries-custom-summary) but i can not find a working example of WHDG (It does not even appears on https://es.infragistics.com/samples/aspnet/hierarchical-data-grid/summaries so it gives me the imppression that I could not be implemented on WHDG)
Recalling that columns are added dynamically, I cannot fix any keycolumn as documentation examples are shown And I cannot use the ig wazard/helper.
Any lights to follow on this situation.?
Thanks in advance!
Hi, sure, please test the suggested approach and keep me posted on your progress.
Best regards, Bozhidara Pachilova
Hello!that is an interesting finding, I'm going to try it. Thanks!
Hello,
Thank you for following up.
After further investigation, I determined that when it comes to a WebHierarchicalDataGrid with auto-generated columns and bands, and when the behaviors are not defined in the markup, there are some differences in the code-behind setup.
To start with, the behaviors, “SummaryRow” in this case, have to be created on the ContainerGrid, which can be accessed through this.WebHierarchicalDataGrid1.GridView.
This means also modifying the SummaryRow properties on the WebHierarchicalDataGrid1.GridView.Behaviors.SummaryRow object.
Furthermore, the child custom summaries have to be defined for a Row Island, which could be done in the RowIslandCreated event. The CalculateCustomSummary handler for the row islands has to be hooked in the RowIslandDataBinding event of the WebHierarchicalDataGrid. This also means passing the corresponding row island on defining the SummaryRowSetting object, for example:
SummaryRowSetting summaryRowSetting = new SummaryRowSetting(ri, "ItemCh");
Attached you will find a modified version of the previous sample demonstrating this. On my side, everything seems to work as expected with the introduced changes:
Please, test the new sample on your side and let me know if it helps achieve your requirement.
Best regards, Bozhidara Pachilova Associate Software Developer
0160.WHDGCustomSummaries.zip
Hello!Returning with this. I was checking it, and, everything went good with the initial case. Even though, child band should be able to add a custom summary as well. I tried to implement it, taking and modifying the code for the principal grid on your example, but, no success.
I try to change the "ChUpdate" column behaviour in order to have the custom summary.
Let me know if you have any idea to handle this.
(I only modify the WebForm1.aspx.cs. tested on 2022.2)
WebForm1.aspx.zip
Hi,
Sure, please, take your time to test the examples. Should you need further assistance, please let me know.
Also, thank you and have a happy new year as well!