Migration to JointJS v4: Issue with graph.fromJSON() #2566
Replies: 1 comment 4 replies
-
Hello everyone for discussion I raised above regarding graph.fromJson in JointJS v4.0. I found that in changelog and according to it, elements retrieved from a JSON string must be predefined in v4.0. like I have a very large number of custom SVGs (approximately 1000) in my library.At the start of the project, as I want to retrieve any particular saved graph and add it to the paper. As I won’t know which SVGs are being used in that graph I cannot write code only for the required svgs, even if I did define it in the format of so the one way I thought to resolve this issue is to at the start of the project define all the custom elements with the required markup and properties, but as I have nearly 1000 svgs it will effect the performance of the project Is there a more efficient way to define all custom elements in dia.Elements at the start of the project? Defining all elements upfront could significantly impact project performance. Any suggestions would be appreciated. |
Beta Was this translation helpful? Give feedback.
-
Introduction
Hello everyone,
I am currently migrating to JointJS version 4 and I am facing an issue with the graph.fromJSON() method. In my project, I have nearly 900 SVGs that I usually load to the JointJS paper as follows:
In the database, I am saving the JSON string of the graph. In previous version Even when I restart the project don't load any shapes or svgs to the paper I was able to retrieve the old graph using fromJSON(), it works properly and the graph loads correctly. However, when I use v4.0, I get errors stating dia.Graph: Could not find cell constructor for type: 'TagWidget'. Make sure to add the constructor to 'cellNamespace'.
I would like to know if there is any difference between the fromJSON method from before to now, or if I am missing anything. Any help would be greatly appreciated.
Thank you.
Steps to reproduce
No response
Restrictions & Constraints
No response
Does your question relate to JointJS or JointJS+. Select both if applicable.
JointJS, JointJS+
Beta Was this translation helpful? Give feedback.
All reactions