Well the thing is:
I have a load button which shows all possible models in a simple radio list.
If someone clicks on one of these radios, a preview image should be shown.
But I guess it’s not possible to show a preview image on the fly without populating the diagram first?
Another question though: when I save these models in a database (in the same format as myDiagram.model.toJson())… If i want to retrieve the database field using ajax, do I use a json dataType and encode the value? or simply as text?
There is no way to produce an image of a diagram without first creating the diagram. But that does not mean you could not use a thumb-nail image, which you could generate automatically on first demand and save for later views.
Regarding the data type for saving the model: I cannot answer that because it depends greatly on the database. You should find out from your database provider what the best datatype would be for JSON data based on your expected usage. It might be that there is no difference between a “json” data type and a “text” data type. Or it might be that there is a huge difference, permitting better queries or indexing or whatever. It depends on what you want to do and what the database does.