Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Events doesn't get cleared off (Read 1742 times)
dittu
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 20
Joined: Feb 6th, 2015
Events doesn't get cleared off
Mar 2nd, 2015 at 12:45pm
Print Post  
Hi Stoyo,

Based on the dropdown values, I want to recreate my diagram.

diagram = Diagram.create($("#diagram")[0]);      
diagram.addEventListener(Events.nodeClicked, onNodeClicked);

I have set the diagram to null
diagram = null;

and when I recreate it, event get fired twice, thrice and so on. Events doesn't get cleared off setting diagram object to null. Can you provide your help on this?

Thanks in advance.
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Events doesn't get cleared off
Reply #1 - Mar 2nd, 2015 at 3:31pm
Print Post  
Hi,

You could call diagram.clearAll() to clear diagram's contents instead of recreating everything. Diagram.create() associates the new class instance to specified DOM canvas element without detaching old ones. With Microsoft Ajax library you would call diagram.dispose() before the new create() to detach old objects from <canvas>, but we now see we haven't implemented dispose method in jQuery implementation. So if you prefer recreating all objects, you might as well create a new <canvas> element dynamically through DOM API, and replace existing one in the document before calling Diagram.create(). Otherwise just call clearAll() before rebuilding diagram contents.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint