Displaying a button conditionally

Hi

Is there a way I can use a button in a node template, such that it is shown only when a certain condition is fulfilled? Maybe by defining and calling a function that returns a boolean?

Thanks in advance.

As a follow up, I found out how to use the visible property to set the buttons visibility, however, is there a way I can set the visibility of a node depending on whether the node has a parent or not?

Implement http://www.gojs.net/latest/api/symbols/Node.html#linkConnected and http://www.gojs.net/latest/api/symbols/Node.html#linkDisconnected event handlers. You can call http://www.gojs.net/latest/api/symbols/Node.html#findTreeParentLink to see if there is a link to a tree parent node.