I am using the 16.1's UltraPivotGrid against a flat data source (such as generic List of a Poco object).
I was able to programatically define the rows, columns, metrcis and filters. However, how do I save the chosen layout which means, user modified rows/columns, or state such as expanded rows, columns, etc?
This is on Winforms.
In the data source you have the following events
AxisAddHierarchyAsyncCompletedAxisRemoveHierarchyAsyncCompletedAddFilterAsyncCompletedRemoveFilterAsyncCompletedAddMeasureAsyncCompletedRemoveMeasureAsyncCompleted
These get fired when the user Adds / Removes Filters, Columns and Rows
Create 4 distict lists to contain this information
List<string> measures, cols, rows, filters;
Then on each of those events add / remove accordingly
private void Ds_RemoveMeasureAsyncCompleted(object sender, Infragistics.Olap.RemoveMeasureAsyncCompletedEventArgs e) { measures.Remove(e.MeasureUniqueName); }
private void Ds_AddMeasureAsyncCompleted(object sender, Infragistics.Olap.AddMeasureAsyncCompletedEventArgs e) { measures.Add(e.MeasureUniqueName); }
private void Ds_RemoveFilterAsyncCompleted(object sender, Infragistics.Olap.RemoveFilterAsyncCompletedEventArgs e) { filters.Remove(e.HierarchyUniqueName); }
private void Ds_AddFilterAsyncCompleted(object sender, Infragistics.Olap.AddFilterAsyncCompletedEventArgs e) { filters.Add(e.HierarchyUniqueName); }
private void Ds_AxisRemoveHierarchyAsyncCompleted(object sender, Infragistics.Olap.AxisRemoveHierarchyAsyncCompletedEventArgs e) { if (e.AxisType == Infragistics.Olap.AxisType.Row) rows.Remove(e.HierarchyUniqueName); else rows.Remove(e.HierarchyUniqueName); }
private void Ds_AxisAddHierarchyAsyncCompleted(object sender, Infragistics.Olap.AxisAddHierarchyAsyncCompletedEventArgs e) { if (e.AxisType == Infragistics.Olap.AxisType.Row) rows.Add(e.HierarchyUniqueName); else rows.Add(e.HierarchyUniqueName); }
You can then serialize or (somehow) save those lists and then next time you load the Pivot you can set those in your FlatDataSourceInitialSettings()
var settings = new FlatDataSourceInitialSettings();
//Load up your rows, columns, measures and filters and create a comma separated string for each one I assume you can figure that part out yourself
settings.Rows = GetCommaSeparatedList(rows);
settings.Columns = GetCommaSeparatedList(cols);
settings.Filters = GetCommaSeparatedList(filders);
settings.Measures = GetCommaSeparatedList(measure);
Hope this helps!