Need a special offer?Find out if your project fits.
+

Expand/Collapse buttons not working with multi level hierarchy and dynamic dimensions

Answered
Andrew R Fox asked on February 1, 2024

Hi,
I've implemented the Expand/Collapse buttons for pivot table and it works fine only for fixed single column or we can say static table only with fixed dimension.

Referenced from below links:
https://www.flexmonster.com/api/expanddata
https://jsfiddle.net/flexmonster/r7t83L8L
Our scenarios:
We have a long dataset and we are getting that data from an API and, so we don't know the dimension name (as dataset change based on ID we sending in request).

So we don't know the dimension name in advance in this scenario, but I filtered that dataset and get the dimension name somehow and set it and it work fine for that column.

Once the dataset rendered in pivot table, then if we change the dimension from "Fields" then buttons not working because that newly selected dimension name not set there.

So how can we change the dimension name dynamically in runtime?

Other one is that, when I added a rows in default set dimension by 3 level, then try to expand, then it's targeting only default set dimension only not internal items.

So how can we handle these type of scenarios, please let us know.

Thanks!

5 answers

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster February 2, 2024

Hello Andrew,

Thank you for reaching out to us.

You can use the getAllHierarchies API call to access all the field names. Also, it is possible to get the names of the current fields on the grid using the getReport method. Then, you can use those field names from the report.slice object when implementing the logic of expand/collapse buttons.

Please let us know if it works for you. Looking forward to hearing from you.

Kind regards,
Nadia

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster February 13, 2024

Hello,

Hope you are doing well.

We were wondering if you had a chance to check the suggested approach. Could you please confirm if it works for you?

Looking forward to hearing your feedback.

Kind regards,
Nadia

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster February 22, 2024

Hello,

Hope you are doing great.

Just checking in to ask if you had a chance to check the getAllHierarchies and getReport API calls. Please let us know if they work for you.

Looking forward to hearing from you.

Kind regards,
Nadia

Public
Andrew R Fox February 22, 2024

Sorry for delay, this worked, thank you!

Public
Nadia Khodakivska Nadia Khodakivska Flexmonster February 22, 2024

Hello Andrew,

Thank you for the feedback!

We are glad to hear that it works for you.

As always, do not hesitate to contact us in case other questions arise.

Kind regards,
Nadia

Please login or Register to Submit Answer