Hey, I'm trying to dynamically adjust the heightType of a container by pressing a button. From "fixed" to "auto" using event handler I'm trying run script: "{{container1.heightType = 'auto'}}"
Unfortunately, the heightType stays on "fixed"
Hey, I'm trying to dynamically adjust the heightType of a container by pressing a button. From "fixed" to "auto" using event handler I'm trying run script: "{{container1.heightType = 'auto'}}"
Unfortunately, the heightType stays on "fixed"
Hey @Michael_S!
In general, Retool doesn't support the pattern of component.property = something
. Instead, Retool uses methods, like component.setValue("world's best boss")
. There are a limited number of these setter methods (some components have .setHidden(true), for example, but some don't) so imo, the best way to figure out which setters are accessible by a specific component is to just type the component name followed by a .
(e.g. textInput1.) to bring up the autocomplete menu and look for all the options in the Function
category.
If you don't see one that would work (for example, I don't think we have any height setter functions like container1.setHeight('auto')
), then there's a common workaround we can use if the setting can be dynamic. However, in the case of the container height specifically, it doesn't like there's a way to make it dynamic But I'll file a feature request for this now!
It would need to have some open input field like this to be dynamic:
https://community.retool.com/t/making-any-component-value-dynamic-in-retool/6983
state1.setValue(new_value_here)
I've also attached the app I tested this in (see the last tab for the .setValue workaround), feel free to play around with it to get your ideal setup + ask me any questions!
Time-20picker-20-5BComponent-5D.json