Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Pivot Grid : Saving the layout
posted

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.

  • 405
    Offline posted

    Here is an example of it working using the technique I explained in the earlier post

    https://www.youtube.com/watch?v=8PKGK2K4nC8

    Hope it helps!

  • 405
    Offline posted

    In the data source you have the following events

    AxisAddHierarchyAsyncCompleted
    AxisRemoveHierarchyAsyncCompleted
    AddFilterAsyncCompleted
    RemoveFilterAsyncCompleted
    AddMeasureAsyncCompleted
    RemoveMeasureAsyncCompleted

    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!

  • 23930
    Offline posted

    Hi Riyaz,

     

    Thank you for posting in our forums.

     

    Currently the UltraPivotGrid doesn’t have such functionality. We have a product idea for this in our product idea site. You can find it here. What I would suggest is to upvote the idea. When planning new releases, our Product Management team will look at the most popular features and use your feedback to prioritize upcoming work.

     

    Please let me know if you have any additional questions.