Dynamic panel - Toggling b/w auto-fitting and setting size conditionally


#1

Hello friends!

I have a repeater within a dynamic panel which is set to ‘Fit to content’. Thus, the height of the dynamic panel automatically changes when the repeater data is filtered. However, I have a situation where I need to fix an upper limit for the height. I’m able to achieve this too using ‘Set size’ conditionally. Now, the problem is this becomes a sticky setting and the height never changes when the filtered repeater data contained in the dynamic panel is lesser than the set height (i.e. the upper limit). In other words, I’m looking for an ability to revert the dynamic panel’s height to auto-fit when the filtered repeater data is lesser.

How can I achieve this? Could anyone demonstrate with an example please?

Thanks!
-B.Mani


#2

Here is a demo using a repeater with filters that adjust the height.
resize dynamic panel with max height.rp (70.0 KB)

On your dynamic panel, add a Resized event with conditional case that tests the height. If it exceeds the maximum, then Set Size of “This” to the maximum. Here’s the key piece of code:
image


#3

@mbc66 In your example, I’d request you to apply (say) a red background colour to the dynamic panel and try the same. You will notice that the dynamic panel is actually not resizing when the filtered repeater data is lesser. That was exactly the problem I tried to point out. When the repeater data is lesser the size remains set to the maximum and won’t reset back. If you now read my original post, I hope it’ll make more sense. Thanks much as always!


#4

Aha… I see what you are saying now. I failed to test this thoroughly. In my prototype, clicking back and forth on the Fruits and the Vegetables buttons to swap these filters does work. But, once the dynamic panel exceeds the maximum height (Show All button clicked and all filters removed) and the conditional case in the Resized event triggers the dynamic panel to be sized with Set Size it no longer works.

So, it looks like the dynamic panel’s Fit to Content setting does not work after the dynamic panel is resized with a Set Size action. This could be considered a bug because I doubt most users would expect it to work this way. However, I can envision scenarios where someone wants the dynamic panel to fit to content only until some user or system event and no longer after that …but that likelihood is probably very small. I’d say it is at least a feature request for support@axure.com to change this behavior, if possible.

My first workaround attempt was to assign an additional conditional case that handles “less than or equals” the max height, setting the dynamic panel to the height of the repeater (see Page 2 of the updated .rp file below.) This did not work, and it seems to have created a critical problem in which the repeater filters no longer work, and at least once the prototype player locked up in the browser–I couldn’t change pages.

My second workaround attempt seems to work well enough. I removed the Set Size actions from the dynamic panel, and instead created an outer dynamic panel from the existing dynamic panel. On this outer panel, I unchecked Fit to Content so it’s size remains fixed. I assigned a “Scroll Vertically” setting to this panel. So, the inner dynamic panel resizes automatically based on its content–the repeater height–and when it is larger than the max, the outer dynamic panel masks this “overflow”. See Page 3 of the updated .rp file below.

resize dynamic panel with max height.rp (141.4 KB)


closed #5

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