To begin we need a document which has two or more sections. For this sample I created a report which has a Category and Sales totals in one section and has an additional section with category, year, and sales.
I want to have a selector which allows me to pick which groups I want to display. To do this, I will add a report to the documents which only contains my generic attribute. Then add the generic attribute to both grids.
The screenshot below shows some wacky results, but we’re going to fix that.
To control the wacky results, we will add an attribute element selector, select the “generic attribute”, and target the two grids. We must also set the selector to only allow for a single selection at a time.
The grids look better, but now we must apply view filter logic to conditionally display the grids we want. We know that the first grid must always be displayed, so no view filter logic needs to be applied. The second grid should only be display when the Group2 option is selected.
To apply this logic, open the view filter settings and set the “generic attribute” in "Group2".
We should also make sure that the section of the document is set to grow to fit the grid space. To do this right click the section of the document and select these options.
You'll also have to make sure the project is set to hid empty grids within a document.
These are the end results:
The last piece is to format the generic attribute. Just set the text width to 0 for this column and the user won’t notice the additional column. I like to take a few extra steps by setting the text font size to 2, removing cell borders for the generic attribute and set the background to “no fill”, but that isn’t required.
And there you have it! Custom expand and collapse functionality using only out of the box functionality. Have fun!
Thanks for checking out this blog post. If you found this post helpful please consider donating. Any contribution is appreciated! Just click the PayPal icon at the bottom of this page.