Re: how works graph.clear()?

985 views
Skip to first unread message

David Durman

unread,
Aug 1, 2014, 4:40:06 AM8/1/14
to joi...@googlegroups.com
Hi Yoli,

Here is the link pointing to the source code of the graph >> clear() method: https://github.com/DavidDurman/joint/blob/master/src/joint.dia.graph.js#L119. It actually does only a little, it removed all the cell models from the internal 'cells' collection. To understand this, I suggest to look at Backbone.Model and Backbone.Collection (http://backbonejs.org/, JointJS uses Backbone internally). The batch:start and batch:stop events are not that important and don't affect anything. Those are used by Rappid plugins for batching up operations for, for example, later bulk undo/redo (in case of the CommandManager plugin).



---

David Durman
client IO


On Fri, Aug 1, 2014 at 2:59 AM, yolidob <yol...@gmail.com> wrote:


         I have declared a paper with a graph inside. I bring the option to the user to create another graph by choosing another file. In order to do this, I read the graph from local  and  I load the graph with fromJSon. The problem is anything appears on the paper because there is a problem with the method graph.clear(). The old graph doesn't dissapear, only parts because it enter into the adjustvertices method (my method is almost the same).

 So, in order to find the error , I would like to know how works graph.clear() and why stops in this particular function.


Thanks in advance,

Yoli

--

---
You received this message because you are subscribed to the Google Groups "JointJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jointjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages