Expand all dimenshions

Answered
Jeremy Deats asked on April 4, 2016

Is it possible to programmatically expand all dimenshions and then have the expanded setting persisted when the report is saved/restored?

2 answers

Public
Iryna Kulchytska Iryna Kulchytska Flexmonster April 4, 2016

Hi Jeremy,
 
Thank you for your question.
To expand all dimensions programmatically the following API call can be used:

flexmonster.expandAllData();

API call works the best if you, for example, want to extend our default toolbar by adding a button "Expand all" that will perform this action when a user clicks it.
 
In case you want to have all the nodes expanded by default in the report right after it is loaded, please use expandAll and drillAll report options, as follows:

var report = {
dataSourceType: "microsoft analysis services",
proxyUrl: "http://olap.flexmonster.com/olap/msmdpump.dll",
cube: "Adventure Works",
catalog: "Adventure Works DW Standard Edition",
rows: [{uniqueName: "[Product].[Category]"}, {uniqueName: "[Reseller].[Business Type]"}],
columns: [{uniqueName: "[Measures]"}],
measures: [{uniqueName: "[Measures].[Reseller Order Count]"}],
expandAll: true,
drillAll: true
};

flexmonster.embedPivotComponent("", "pivot-content", "100%", "600", report, true);

In both cases, the expanded settings will be saved in the report and restored from it next time when it is loaded.
 
Please let me know if the answer is helpful for you.
 
Kind regards,
Iryna

Public
Tanya Gryshko Tanya Gryshko Flexmonster December 5, 2016

Hello Jeremy and all Flexmonster users,
After the release of version 2.3, we would like to provide you with an updated sample illustrating how to use expandAll option in report JSON:

var report = {
    dataSource: {
        dataSourceType: "microsoft analysis services",
        proxyUrl: "http://olap.flexmonster.com/olap/msmdpump.dll",
        cube: "Adventure Works",
        catalog: "Adventure Works DW Standard Edition"      
    },
    slice: {
        rows: [
            {uniqueName: "[Product].[Category]"}, 
            {uniqueName: "[Reseller].[Business Type]"}
        ],
        columns: [{uniqueName: "[Measures]"}],
        measures: [
            {uniqueName: "[Measures].[Reseller Order Count]"}
        ],
        expands: { expandAll: true },
        drills: { drillAll: true }      
    }
};
var pivot = $("#pivotContainer").flexmonster({
    toolbar: true,
    report: report,
    licenseKey: "XXXX-XXXX-XXXX-XXXX-XXXX"
});

Regards,
Tanya

Please login or Register to Submit Answer