Dynamically named panels

Hi. I would like to name a panel with the id of the corresponding entity it represents. Something along the lines of gMake(go.Panel, “Auto”, new go.Binding(“name”,“id”) … ), however I keep getting this error: Binding error: cannot modify GraphObject.name on Panel(Panel.Auto)#810.

Am I doing something wrong?

Yes, that error is intentional. We don’t want something like Node.findObject to potentially return the wrong GraphObject just because its name has changed, and we don’t want the overhead of having to do a full lookup each time.

But why do you want the names to be changing at run-time? Can’t you generate names at template definition time?

I want to be able to access a single item of a data-bound vertical panel to be able to hide/show it. I know I could say bind(“visible”,“visible”) and create a visible property in the model, but somehow I would like to keep my model free of visualization details… But I think I can do a findItemPanelForData on the panel with the model itself, right?

Yes, assuming the item data is an Object, not a number or a string or a boolean.