Cant use binding visible

Hey i am using gojs. When i am want create some statement to choice this object/nodes is visible or not. Why i cant use it ?

thats my code

$gojs("Button",{
                                click: detailKandidat,
                                row: 2,
                                column: 0,
                                cursor: "pointer",
                                visible:false,
                              },
                              new go.Binding("ButtonBorder.fill", "IS_NOMINATIF", generateStatus),
                              new go.Binding("ButtonBorder.stroke", "IS_NOMINATIF", generateStatus),
                              new go.Binding("_buttonFillOver", "IS_NOMINATIF", generateStatus),
                              new go.Binding("_buttonStrokeOver", "IS_NOMINATIF", generateStatus),
                              new go.Binding("visible", "level",
                                         function(val) { 
                                            return true; })
                              .ofObject(),

Thankyou.

Use lines consisting of only triple backquotes to surround the lines of code that you want to quote in your post.

I’m sorry, but I do not understand what you want to do.

i am using indonesia languange. Sorry

Aku ingin membuat sebuah kondisi dimana tombol bisa tampil dan tidak tampil berdasarkan level dari data nodes nya.

I want to create a condition where buttons can show or hide based on the level of the data nodes.

What does detailKandidat do? Or what do you want it to do?

Or are you asking about how to have the Button itself be visible or not?

Let’s just ignore the click event. What I want is when looping data, then the button reads the condition of its level data, if the level data is not 0 then it displays the button other than that, just hide it.

This might be a situation where a Binding would not be natural. Implement a Node.linkConnected event handler, or just iterate over all of the Diagram.nodes in a “InitialLayoutCompleted” DiagramEvent listener.

Maybe after looping the data, then I check one by one from each node only? then just look for the name object and then set it visible?

Is that the way to do it?

If you give the Button a GraphObject.name, then at runtime you can call Node.findObject to find the Button and set its visible property.
https://gojs.net/latest/learn/graphObject.html#NamedGraphObjectsAndPanelFindObject