Getting the children of a ScrollView?

Do anyone know if there is a way to reach the children of a ScrollView, from a Javascript node, to be able to get for example the height of the items?

Thanks,
Jonas

Don’t think there are any documented API’s for doing that, but you can access both children and their height using the following code:

define({
    inputs: {
        scrollView: "reference"
    },
    run: function(inputs, outputs, changedInputs) {
        for(const child of inputs.scrollView.getChildren()) {
            const height = child.getLayoutRect().height;
            // do something with the height
        }
    }
});

Hope that’s what you were looking for!

1 Like

Perfect! I will give it a try :slight_smile:

Thanks Michael

1 Like

“inputs.scrollView.getChildren()” work like a charm! But the object “child” doesn’t seem to have a function named “getLayoutRect()”

Tried to find it (or a substitute) myself, but got a little bit lost in json-space… :wink:

Try:

child.getChildRoot().getLayoutRect().height