Pass thisInstance by reference

I know the thisInstance object can be used within the binding menu, as explained in the following post.


Source

I’d like to pass the thisInstance reference as object property to get the actual value of the element’s style.display property (since the value might change, I can’t pass it directly). I tried it, but it seems it’s setting the property value to an empty object {} instead of the reference.

Is there a way to pass it, or can it really only be used within the binding menu? It’s a bit counterintuitive to be able to use an object but not pass it by reference.

Here is where I set it as property to the object (and it looks as expected in the preview window below the code):

But when I access the object from somewhere else, it’s just an empty object:

(Please ignore what the code itself does. It’s out of context)

Also: Why isn’t the thisInstance.hidden property true, when thisInstance.style.display == “none”? I would have expected that the display property determines the value of the hidden property (at least partly, as we also have the conditional rendering feature).

Have you tried console logging that empty object? The instance also appears empty, but you can get all of those properties. My best guess is, that if you console.log it via JS, it could give you the object back. You could always use that instance to get your own instance if that doesn’t work.

AH, didn’t think of that! It’s just appears as empty object in the tree and when I print the whole object with JSON.stringify() , BUT it does indeed work inside the Formula/JavaScript container.

Thanks for the help! :pray:

I think this happens because it’s not a standard object, but an instance of a HTML Element