Resize backing Dynamic Panel with filtered Repeater

I’ve got an accordion set up (nested dynamic panels), and inside of the expanded state of each accordion is (will be) a repeater with filter/sort functions. The accordion successfully pushes/pulls the widgets below it. The problem I’m having is I cannot figure out how to change the size of the background panel (*HGbacker) once filters have been applied to the repeater. The intended function is that as you filter the repeater, the background DP resizes and push/pulls the lower widgets accordingly.

I have tried Item Loaded > Set Size, Loaded > Set Size, and Resized > Set Size, all to no avail. I have also tried these variations when the *HGbacker both is and isn’t a dynamic panel itself. My .rp file is attached below.

resizeDPwithFilteredRepeater.rp (9.1 MB)

I think there is a workaround for this issue that uses some global variables to “keep track of” the number of current rows in the repeater and thusly translate that to discrete sizes to apply to the backing dynamic panel, but I’m unsure of how to navigate those waters.

Any solutions are greatly appreciated.

You could add some actions after each Add Filter and Remove Filter action to Set Size of *HGbacker to the size of the repeater plus the size of all the widgets above it (title, column headers) plus the additional size that *HGbacker needs to maintain your margin (3 px), and then action(s) to move all the widgets below the *AAvIAhandguns panel, but wouldn’t that be a pain? Better to do this in one place, whenever the repeater gets resized.

Repeaters do not have a Resized event, but if you wrap it in a dynamic panel (and leave the default “Fit to Content” option on), then you can use that panel’s Resized event to get the height value needed to resize *HGbacker and move things accordingly. This way, any time the repeater is resized (from a filter or adding/removing rows, etc.) it can automatically set the size of *HGbacker. Now, as it turns out, the HGbacker rectangle widget is what you want to resize because if you resize *HGbacker to anything larger than HGbacker it will have a transparent fill and your gray background wont be large enough, so won’t look correct. Now, you do not need to put HGbacker in a dynamic panel, but changing its size will automatically change the size of its parent dynamic panel, *HGbacker, so I just left it as is.

I did all of this in the updated .rp file attached below. See the Crane Dash (2) page, where I duplicated Crane Dash page and applied the fix I describe above.

You’ll notice on Crane Dash (2) the background is resized correctly (i hope) but widgets below are not moved. While you can push/pull widgets with a Set Panel State action, or Show/Hide action, unfortunately there’s no push/pull option in a Set Size or Move action. So, on the Crane Dash (3) page, I show a workaround. Recall that adding/removing a filter to the repeater will change the repeater’s size, which in turn will change its parent panel’s size, which in turn will change HGbacker’s size, which in turn will change *AAvIAhandguns’ size. I added a Resized event to the *AAvIAhandguns panel which will move the widget immediately below it. For simplification, I created a few dynamic panels: *AAvIAsubmachineguns, *AAvIAshotguns. and *AAvIAother. So, *AAvIAhandguns will move *AAvIAsubmachineguns to ( [[Target.x]] , [[This.bottom + 10]] ), then *AAvIAsubmachineguns has a Moved event that moves *AAvIAshotguns in the same manner, then *AAvIAshotguns moves *AAvIAother in a chain reaction.

Of course you could put all the Move actions in just *AAvIAhandguns, but then it needs to know about everything below it on the page rather than just the one element below it. I find it is usually better to take an “object oriented” type of approach, but others prefer to keep the interaction code in as few widgets as possible. Benefits and drawbacks to either…

resizeDPwithFilteredRepeater.rp (9.8 MB)

1 Like

Thank you so much MBC66, you are a true wizard.

As I was drifting off to sleep last night, I came up with a more hackneyed solution, but I much prefer how you handled it in Crane Dash (3). Since I’m already updating the filters, sorts, and cases for each repeater, adding a dynamic panel and a couple more actions isn’t much more work!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.