I'm trying to construct a Paper, while I already have a ready model for it.
for example:
var graphModel = new joint.dia.Graph;
/* add cells to graphModel... */
// now construct the Paper to render on screen
var paper = new joint.dia.Paper({
el: $('.selector'),
width: width,
height: height,
gridSize: 1,
model: graphModel
});
It looks like the Paper renders upon add
, change
events of the it's model, without checking if the model is already populated with cells to render (at initialization phase).
Sometimes the model is coming by a REST response that was already parsed into graphModel
- so in this case the model is ready (so no need to re-manipulate it) and I just want to render it
Cheers,
Ziv
Have you tried calling
paper.render();
method? This should render the view with the data it already has.
The thing you're looking for is the paper#resetCells
method. Use it like this (see fiddle):
paper.resetCells(graphModel.get("cells"));