Hi,
Firstly apologies if this is a simple mistake on my part or has been covered elsewhere but I've just started back with the grid and calc manager and am struggling to get the attached to work (VS2010 with 2013.2075)
Simple project attached and when I click in the new row the formula for column d doesn't appear to work but it works fine for existing rows. If I change the DeferredCalculationsEnabled to True on the calc manager then it works fine but my summary isn't fully calculated unless the grid is fully scrolled. I've tried various combinations of the DeferredCalculationsEnabled and CalcFrequency but just can't seem to get it to give a complete summary and complete the formula for a new row.
Any help greatly appreciated.
Thanks
Sorry, this was my fault. I thought the sample had DeferredCalculationsEnabled set to true.
Anyway, you can still get it to work, but you have to turn off DeferredCalculationsEnabled temporarily when calculating the summary:
Friend Sub BeginCustomSummary(summarySettings As Infragistics.Win.UltraWinGrid.SummarySettings, rows As Infragistics.Win.UltraWinGrid.RowsCollection) Implements Infragistics.Win.UltraWinGrid.ICustomSummaryCalculator.BeginCustomSummary CType(ultraCalcManager, Infragistics.Win.UltraWinCalcManager.UltraCalcManager).DeferredCalculationsEnabled = False Dim columnRef As IUltraCalcReference = ultraCalcManager.GetReference("//UltraGrid1/abc/d") ultraCalcManager.EnsureCalculated(columnRef, True) CType(ultraCalcManager, Infragistics.Win.UltraWinCalcManager.UltraCalcManager).DeferredCalculationsEnabled = True Me.invoiced = 0 Me.paid = 0 End Sub
Although the more I think about it, the more I realize that DeferredCalculationsEnabled isn't really giving you a lot of benefit here. Since you have a a summary at the top of the grid, everything has to be calculated immediately, anyway, in order for the summary calculation to be accurate. So unless the summary is scrolled out of view and you make a change, the calculations can almost never be deferred.
Mike,OK looking at summary in isolation (can try and resolve row template later), I've- just downloaded again to be sure- loaded into VS - Infragistics version is 13.2.20132.2075 ie I haven't needed to change control versions from the one you supplied- run the project - deferred calcs is set to false on your control - for results see form image to top right - summary showing 930 - correct- stopped project and changed deferred calcs to true on the control - for results see image - summary showing 90 - wrong as only includes first 9 rows. You can also see from this image in the output that the values for column d are nothing from row 10 onwards. You can also see the extra code you've added in the BeginSummary sub which I haven't changed.
I'm sure I must be doing something wrong but can't see what.Thanks for your continued help it's really appreciated.
If the Deffered Calcs FALSE case is not working, then it could be that the fix didn't make it into the latest service release. I thought it did because I asked Developer Support to try it out and they couldn't reproduce the issue, but I could be wrong - in which case it will be fixed in the next SR.
For the TRUE case, are you running the new sample I attached here with my last post? That sample works for me in every version I tried. I even went back to 11.2 just to be sure. The workaround I provided here should work regardless of what version you are using. I suppose it's possible that there is some fix in my internal version that's making it work for me and that you don't have, but it seems extremely unlikely.
Mike,
Sorry for the delay and thanks for the update however I still can't get it to work. I've downloaded your new version with the extra bits of code, upgraded to 14.1.2014.1.2059 and re-run. I still get the same behaviour:
- Deferred Calcs = True - template row works but summary doesn't
- Deffered Calcs = False - template row doesn't work but summary does
Can you please check and let me know if I'm missing something.
Hi,I've been looking into these two issues.
Issue #1 - The summary is not including the cells that are out of view when DeferredCalculationsEnabled is TRUEThis is not a bug. I didn't notice it when I ran your sample, but your summary is not using a formula. Instead, it's using an ICustomSummaryCalculator. The problem with this is that it means the summary is not part of the calculation network. The grid and the CalcManager don't know what your summary calculation involves, so the calculation network doesn't know that your summary is dependent on the formula in column D.
The ICustomSummaryCalculator you are using is working correctly. It's including every row, but the value in the cells for that row is returning Nothing for any cells that are out of view. The same thing would happen if you checked the value of the cells anywhere else in code.
There are two possible solutions to this issue.
1) You could use a Formula for your summary. This would be a little tricky, since your summary is complex and needs to build a string including more than one value. Your formula would probably be pretty unwieldy, although you might be able to reduce the complexity by making your own custom function(s).
2) The second option is to force the calculation of column D before the summary is calculated. This is easier, but it kinda defeats the purpose of DeferredCalculationsEnabled.
If you want to try to second approach, you have to change your SummaryTotals class so that it has a reference to the UltraCalcManager as an IUltraCalcManager. So, for example, you could pass it into the constructor:
Friend Sub New(ultraCalcManager As IUltraCalcManager) Me.ultraCalcManager = ultraCalcManager End Sub
Then, in the BeginCustomSummary method, you would force column D to be calculated:
Dim columnRef As IUltraCalcReference = ultraCalcManager.GetReference("//UltraGrid1/abc/d") ultraCalcManager.EnsureCalculated(columnRef, True)
I am attaching a modified version of your sample here that demonstrates this working.
Issue #2 - When DeferredCalculationsEnabled is FALSE the cell in the TemplateAddRow is not calculated until you leave the row.
I am unable to duplicate this issue using our latest internal build or the latest available service release. So I think this may have been fixed by the fix for some other (related) issue.