Note: PivotGrid controls can be displayed in XAF via two modules - Pivot Chart and Pivot Grid. This example is related to the Pivot Chart module. To learn how to access the PivotGridControl in the Pivot Grid module, refer to the How to access and customize controls used to represent data in list views (PivotGridControl, SchedulerControl, ChartControl, etc.) article.
Scenario:
PivotGridControl displays data in the data area using a certain summary - Sum or Count by default. Thus, when a value of type String or Boolean is displayed, the user does not see real values. This example demonstrates how to show these values and provide the capability to change them. A solution is based on the following XtraPivotGrid example: String editing in the XtraPivotGrid control.
Steps to implement:
1. A ViewController for the Analysis DetailView (PivotGridInplaceEditorsController) is created in the WinForms-specific module.
2. This controller accesses and customizes the Analysis editor (AnalysisEditorWin) in two ways:
2.1. Settings that do not depend on the data source and are not stored in the Analysis object are defined when the View controls are created and when the Analysis object's Data Type is changed. The PivotGridControl is accessed via the AnalysisEditorWin.Control.PivotGrid property.
2.2. Settings related to the PivotGrid fields depend on the data source and are loaded only at certain moments (e.g. when the Bind Analysis Data action is executed). To change them, it is convenient to use a custom field builder, or handle events of the default field builder. The field builder is used by the analysis editor to create PivotGrid fields based on the data source, or restore them based on settings stored in the Analysis object. To access the FieldBuilder, use the AnalysisEditorBase.Control.FieldBuilder property. In this example, a custom FieldBuilder is used to customize field settings.
There are also two other ways to customize the PivotGridControl when its settings are loaded:
1. By handling the AnalysisEditorBase.PivotGridSettingsLoaded event.
2. By handling the AnalysisDataBindController.BindDataAction.Execute event.
These events are appropriate for customizing the existing Analysis reports. However, the PivotGridSettingsLoaded event will not be raised when the Analysis object is just created, and both events are not raised when the DataType of the existing Analysis object is changed.
See Also:
How to make PivotGrid fields invisible when the Analysis view is initialized
Example Comments
Added By: Apostolis Bekiaris (DevExpress) at: 1/16/2013 8:20:39 AM
See also http://community.devexpress.com/blogs/eaf/archive/2013/01/16/how-to-rule-the-pivot.aspx under the All Pivot cells editable and double paragraph