How to perform exapand & collapse feature by one click on multiple fields? Don't want to hard code.


If I have four fields in my pivot table, I don’t want to click on the first field to go to the second field & then on the second field to go the third field & so on. I want to click on the first field & then it should expand all the fields & same for collapsing as well.

1 answer

WebDataRocks Team WebDataRocks August 11, 2020

Hello, Mohit!
Thank you for your question.
To implement the described functionality, we suggest using the setReport API call. Please define the slice with all desired expands, pass the report to the setReport method, and invoke it on click.
Our team also recommends specifying the data source in the global object to load the data once. Please have a look at the example.
Also, we would like to mention expandAllData() and collapseAllData() API calls. They expand/collapse all nodes and perform drill-down/drill-up of all hierarchies in the slice on the grid.
Hope it helps.
WebDataRocks Team