I’m trying to render my graph using a JSON file #2938
-
IntroductionHi, I have a question. In this repo, I’m trying to render my graph using a JSON file. When I manually create the elements with code and add them to the graph, the custom ElementViews work correctly — everything renders as expected and behaves properly. However, when I try to load the same elements from JSON and add them to the graph using graph.fromJSON() or graph.addCells(), the elements don't show up at all on the paper, and none of the ElementViews seem to be applied. Is there something I’m missing in order to make the views work properly when loading from JSON? Any help would be greatly appreciated! Steps to reproduceNo response Restrictions & ConstraintsNo response Does your question relate to JointJS or JointJS+. Select both if applicable.JointJS |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
There is no problem with views. Make sure you pass all arguments when overriding the initialize(...args) {
super.initialize(...args);
this.on("change:size", this.updatePortsOnResize, this);
} |
Beta Was this translation helpful? Give feedback.
Yes, you should listen to
add
andreset
graph events.