Gadget autoadjusts to unpredictable heights after template refresh

Christian_Schönert March 19, 2018

Hello,

 

so I made a gadget that has a lot of UserPref settings that can be changed. Within those, there is the custom_height pref I included.

<UserPref name="custom_height" datatype="hidden" default_value="400" />

In general, the height of the settings page including all UserPrefs is larger than the custom_height set by the user for the actual gadget.

Before it comes up, I am using:

<Require feature="dynamic-height" />

 and in my view template I am using:

gadgets.window.adjustHeight(gadget.getPref("custom_height"));

So when I go to the settings, set a custom height and save, the gadget window displays at that exact height. But if for example I go into the settings and cancel without saving, the height stays from the settings height. When I then click refresh, and the template view function is called again, the gadget frame sets to custom height and immediately after that, sets to a greater height (maybe the settings one) which isn't defined anywhere. So it sets the right height and then bounces back. Only after saving it takes up the right height. 

How can I prevent this automatic height change? Is there some event I can intercept or change? All suggestions are welcome.

 

Regards

Chris

0 answers

Suggest an answer

Log in or Sign up to answer