See the How to: Calculate a Property Value Based on Values from a Detail Collection help topic for more information.
See Also:
XPO Best Practices
How to display details collections with descendant classes filtered by object type in a DetailView
Question Comments
Added By: Robert Fuchs at: 1/28/2013 9:01:23 AM
Not using XAF web, just to let you know that there are warnings in 12.2.5:
Warning 1 Could not resolve this reference. Could not locate the assembly "DevExpress.Web.ASPxEditors.v12.2". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. WinWebSolution.Web
Warning 2 Could not resolve this reference. Could not locate the assembly "DevExpress.Web.ASPxGridView.v12.2". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. WinWebSolution.Web
Warning 3 The referenced component 'DevExpress.Web.ASPxEditors.v12.2' could not be found. WinWebSolution.Web
Warning 4 The referenced component 'DevExpress.Web.ASPxGridView.v12.2' could not be found. WinWebSolution.Web
Hi,
I think this sample needs to be reviewed !
There's a problem with it. If You'd put a breakpoint in Product (line 44 or line 54) - the UpdateTotals.. method - get executed when I click "Reload" in the ListView.
Basically - if I have N+1 records in the ListView, and click refresh, it would go and fetch the details for all child records, and recalculate the "Total" on the master record. Though it should NOT.
That kinda the point of having it persistent right ? So it would get recalculated only when one updates the Details collection !
Added By: Dennis (DevExpress Support) at: 6/16/2014 8:32:42 AM @Martin: Thanks, I will answer you in E305 sample - is recalculating "header" values on Reload - though it should not on this.Added By: Arjan van Dijk at: 8/14/2014 2:37:30 PMCan you please give me an example using domain components?
Thx
@Arjan: I am afraid we do not have a ready example for DC. However, to achieve this, use domain logics like AfterChange_PropertyName and others.
Also, a simpler and generic solution will be to use custom calculated fields for this: https://documentation.devexpress.com/#Xaf/CustomDocument3583
Can we extend this example to include the option when delete an Order, the field of the parent Product should be updated accourdingly