Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    How to set initial visibility: "hidden" on a DyanmicForm item

    I'm attempting to set an item initially hidden in a DynamicForm using visibility: "hidden" but it doesn't work e.g. I amend https://www.smartclient.com/smartcli.../?id=helloForm adding
    Code:
    , visibility: "hidden"
    to an item in the helloForm.js tab and click on Try It.

    The item remains visible. Using visible: false will be honoured but I don't want a later toggle of the visibility to affect the layout of other items and understand that using visibility rather than visible is the way to go.

    Is there a way to achieve this?

    TIA

    Dan

    Version: 13.0p Built: 2022-03-01 in Chrome Version 98.0.4758.102


    #2
    "visibility" is a property on Canvas, and FormItems are not Canvases, so it is expected that this property would not have an effect.

    "visible" is the correct property to use for a FormItem.

    When a FormItem is make visible or hidden, items around it necessarily reflow in some way (otherwise there would be overlapping items, or gaps). See the FormLayout overview for how to control what happens.

    Note that, if you actually want a gap where the now-hidden item used to be displayed, you can have a SpacerItem that you make visible at the same time as you hide the item you don't want visible any more.

    Comment

    Working...
    X