Hello Kevin,
Thanks for reporting the issue.
By default, fields formatting with all the pivot-chart control settings is saved in the database. Thus, if you change the formatting in code for existing analysis objects, it won't be applied. To apply it, you should recreate the existing analysis.
Please check out the code of the MainDemo.Module.Win.Updater and MainDemo.Module.Updater classes in the MainDemo to learn more on how to save the settings of the pivot-chart layout in the database.
Let us know in case of any difficulty.
Thanks,
Dennis
Hello Kevin,
This problem will be fixed in our next update. Currently, you can use the following controller as a workaround:
[C#]public class RefreshDisplayFormatController : ViewController { public RefreshDisplayFormatController() { TargetObjectType = typeof(IAnalysisInfo); TargetViewType = ViewType.DetailView; } AnalysisControlWin analysisControl = null; protected override void OnViewControlsCreated() { base.OnViewControlsCreated(); AnalysisEditorWin editor = (AnalysisEditorWin)((DetailView)View).FindItem("Self"); analysisControl = editor.Control; } protected override void OnActivated() { base.OnActivated(); Frame.GetController<AnalysisDataBindController>().BindDataAction.Execute += new DevExpress.ExpressApp.Actions.SimpleActionExecuteEventHandler(BindDataAction_Execute); } void BindDataAction_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e) { IAnalysisInfo analysisInfo = (IAnalysisInfo)View.CurrentObject; ApplicationNodeWrapper applicaitonNodeWrapper = new ApplicationNodeWrapper(Application.Model); ClassInfoNodeWrapper classInfo = applicaitonNodeWrapper.BOModel.FindClassByName(analysisInfo.DataType.FullName); foreach (PivotGridFieldBase field in analysisControl.Fields) { string formatString = classInfo.FindMemberByName(field.FieldName).DisplayFormat; field.ValueFormat.FormatString = formatString; field.CellFormat.FormatString = formatString; } analysisControl.PivotGrid.Refresh(); PivotGridSettingsHelper.SavePivotGridSettings(new PivotGridControlSettingsStore(analysisControl.PivotGrid), analysisInfo); } }
Thanks,
Anatol
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.
Facebook
Twitter
Google+