We have updated Flexmonster Software License Agreement, effective as of September 30, 2024. Learn more about what’s changed.

Expand Cell with multiple levels

Answered
Rushi Lonkar asked on June 30, 2023

Hello,
I wanted to expand a certain column including all the levels below when the report loads.
I created a quick sample to show the problem: https://jsfiddle.net/rvkw0e7f/1/
I used your existing sample and slightly tweaked it to show the issue. I want the Accessories column expanded for the Country of Canada by default. I tried some variations of the expandCell method but was unable to achieve the desired result. Am I missing something simple?
Thanks,
Rushi
 

3 answers

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster July 3, 2023

Hello, Rushi!
 
Thank you for reaching out to us.
 
Kindly note that it is possible to predefine the expanded rows in the sliceObject of your report. For the described case, slice would look as follows:

slice: {
        //other slice properties
        expands: {
            columns: [
                {
                    tuple: [
                        "category.[accessories]"
                    ]
                },
                {
                    tuple: [
                        "category.[accessories]",
                        "country.[canada]"
                    ]
                }
            ]
        }
}

We have modified the provided JSFiddle: https://jsfiddle.net/flexmonster/0zbw1kxv/.
You can read more about expands in our docs: https://www.flexmonster.com/doc/slice/#expands.
 
We also kindly suggest the following generic approach for such cases:

  1. Configure the desired report visualization via Flexmonster UI
  2. Save the report using Save Toolbar tab
  3. Open report.json in any text editor
  4. Copy the necessary part of the report to your project

You are welcome to watch the short YouTube video illustrating this approach: https://www.youtube.com/watch?v=GC4C7XLjccc.
 
Hope you will find our answer helpful.
 
Kind regards,
Solomiia

Public
Rushi Lonkar July 3, 2023

Hello Solomiia,
Your solution works great. I am using the component in Blazor so had some trouble setting up the tuples array correctly in C#. However, by looking at your example, I was able to get it working in Blazor.
Thanks,
Rushi

Public
Solomiia Andrusiv Solomiia Andrusiv Flexmonster July 4, 2023

Hello, Rushi!

Thank you for your feedback.

We are glad to hear that the suggested approach works well for you.

Feel free to contact us in case of any other questions.

Kind regards,
Solomiia

Please login or Register to Submit Answer