Restrict Palette-Diagram-Relations

Hello!

I am developing an application, where the user can dynamically add components to his dashboard and that also implies that there can be several instances of GoJS Diagram Components - each having its own diagram and palette.

I realized though that it is now possible for the user to drop nodes from a palette in component X to the diagram of component Y, although these should not be related at all.

Is there a way to restrict the scope of a palette?

I guess I could use the ExternalObjectsDropped DiagramEvent and make a validation there by checking if the origin of the node (that I could send within the nodeData) is compatible with the diagram ID, but I would rather intervene earlier, so that I also prevent the creation of the preview of the node.

I recognized that the go.DraggingTool and its doActivate / doDeactive hooks are not called in this first dropping procedure.

Is there any other event / hook / tool that I can use for my validation?

Thanks in regard
Jonas!

Set Model.dataFormat to different values.

Ahh, that works, thank you for the quick help!

I never stumbled upon this model property.
But why is it called ‘dataFormat’? I would not associate the underlying meaning to that name, so would have probably skipped, even if I had seen this.

Wouldn’t something like “scope” be more fitting and intuitive?

Conceptually it’s originally in the library from .NET/C#, and in our libraries (GoDiagram, GoXam) made before GoJS, so the name is consistent with those libraries. We just kept the name for GoJS.

DataFormats Class (System.Windows) | Microsoft Learn