Data Bind Aspects
- 3 minutes to read
Before using the analysis editor that represents an Analysis (IAnalysisInfo) object, a data source should be created for it. This topic details how to implement the appropriate data binding behavior of the analysis editor. Before reading this topic, we recommend you consult the overview on the PivotChart module (see Pivot Chart Module Overview).
Default Behavior
A data source for the analysis editor is not created until you execute the BindAnalysisData Action (). Moreover, the data source is not updated after changing the Criteria or DataType property of the current Analysis (IAnalysisInfo) object. To update it, you should execute the UnbindAnalysisData () and then the BindAnalysisData Actions.
This behavior is specially designed to avoid long wait times if a large amount of data is loaded each time something is changed in the current Analysis object. The BindAnalysisData and UnbindAnalysisData Actions use the analysis editor’s IsDataSourceReady flag to allow or prohibit data loading. By default, this flag is set to true. However, the AnalysisDataBindController, which contains these Actions, sets this flag to false when it is activated. So, this Controller and its Actions entirely manage the update of the analysis editor’s data source. You can change this behavior. Below, you will find several ways to do this.
Remove the Bind Analysis Data and Unbind Data Analysis Actions
If required, you can remove the BindAnalysisData and UnbindAnalysisData Actions completely. This means that you should deactivate them for Analysis objects. For this purpose, deactivate the AnalysisDataBindController that contains these Actions. You can do this using any Controller that is activated for Analysis objects. The following code demonstrates how to accomplish this, by inheriting from the AnalysisDataBindController itself:
public class DisableAnalysisDataBindController : AnalysisDataBindController {
public DisableAnalysisDataBindController() {
Active["Disabled"] = false;
}
}
When the AnalysisDataBindController is deactivated, the IsDataSourceReady flag remains set to true. This results in creating a data source when the analysis editor’s control is created, and updating it when the Criteria or DataType property of the current Analysis object is changed.
Implement a Custom Approach to Bind Data
Using the IsDataSourceReady flag of the analysis editor, you can manage data binding as required. The following code demonstrates how to customize the AnalysisDataBindController to load a data source when invoking a Detail View with an Analysis object:
public partial class ViewController1 : AnalysisDataBindController {
protected override void OnActivated() {
base.OnActivated();
analysisEditor.IsDataSourceReady = true;
UpdateBindUnbindActionsState();
}
}
To learn how to access the analysis editor from a custom Controller, refer to the Pivot Chart Module Overview topic.