Reputation: 344
joint.dia.Graph.prototype.clear is not working for me. When I do a clear and log the graph, it seems to still contain all the elements. Is clear an async function?
this.graph.clear();
appLogger.info({graph: this.graph}, "Graph with zero elem");
gives
[2019-11-28T21:03:46+05:30] info: Graph with zero elem
graph: child
attributes:
cells: child
cellNamespace: null
graph: child {cid: "c1", attributes: {…}, _changing: false, _previousAttributes: {…}, changed: {…}, …}
length: 3
models: (3) [child, child, child]
_byId: {c2: child, 5d55f246-c572-4462-b6a0-1325040b2d1a: child, c3: child, 143b2670-c8b4-43d0-8007-c7860405f530: child, c4: child, …}
_events: {all: Array(1), add: Array(1), remove: Array(2), reset: Array(1), change:source: Array(1), …}
__proto__: Backbone.Collection
__proto__: Object
changed:
cells: child
cellNamespace: null
graph: child {cid: "c1", attributes: {…}, _changing: false, _previousAttributes: {…}, changed: {…}, …}
length: 3
models: (3) [child, child, child]
_byId: {c2: child, 5d55f246-c572-4462-b6a0-1325040b2d1a: child, c3: child, 143b2670-c8b4-43d0-8007-c7860405f530: child, c4: child, …}
_events: {all: Array(1), add: Array(1), remove: Array(2), reset: Array(1), change:source: Array(1), …}
__proto__: Backbone.Collection
__proto__: Object
cid: "c1"
_changing: false**
Could you please help?
Upvotes: 0
Views: 244
Reputation: 1428
this method is pretty straightforward, no catches. It removes all cells one by one by calling the remove
on the element/link. Don't you have overridden the remove
on any of the cells? Especially the 3 remained in the graph?
Upvotes: 0