Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Anchoring problem (Read 4248 times)
Gravity
Junior Member
**
Offline


I Love MindFusion!

Posts: 52
Joined: Sep 21st, 2016
Anchoring problem
Oct 5th, 2016 at 1:34pm
Print Post  
Hello,

I have a problem with loading from xml custom nodes, for test purposes i use flowshart.xml which is in samples folder, what i do i just rename classes there into my own thats it.

Well it loads and displays correctly, except diagramlinks and node are not attached, if i try to move it, diagram links stays were whey were... i have custom nodes only with properties, nothing else...

What could be wrong?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Anchoring problem
Reply #1 - Oct 5th, 2016 at 2:39pm
Print Post  
Hi,

If using custom link types, you must also add origin and destination parameters to the constructor and pass them to base one. The control instantiates links like this when loading from XML or JSON -

var link = new type(this.diagram, origin, destination);

The help file lists them as optional, but seems they are required for serialization.

Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Gravity
Junior Member
**
Offline


I Love MindFusion!

Posts: 52
Joined: Sep 21st, 2016
Re: Anchoring problem
Reply #2 - Oct 6th, 2016 at 3:21pm
Print Post  
Slavcho wrote on Oct 5th, 2016 at 2:39pm:
Hi,

If using custom link types, you must also add origin and destination parameters to the constructor and pass them to base one. The control instantiates links like this when loading from XML or JSON -

var link = new type(this.diagram, origin, destination);

The help file lists them as optional, but seems they are required for serialization.

Regards,
Slavcho
Mindfusion


yes i am using custom links, i have defined that in .net classes and i have rewritten js prototype like this:
Code (Javascript)
Select All
myDiagramLink = function (parent, origin, destination) {
    myDiagramLink.initializeBase(this, [parent, [origin, [destination]]]);
}
 



i have no special logic of drawing, just couple of properties on the DiagramingLink, but right now not using them and they are empty tag's in XML

What else could it be?
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Anchoring problem
Reply #3 - Oct 6th, 2016 at 4:30pm
Print Post  
You should pass the arguments as a flat array, same way you would call Function.apply -

Code
Select All
...initializeBase(this, [parent, origin, destination]); 



Regards,
Slavcho
Mindfusion
  
Back to top
 
IP Logged
 
Gravity
Junior Member
**
Offline


I Love MindFusion!

Posts: 52
Joined: Sep 21st, 2016
Re: Anchoring problem
Reply #4 - Oct 7th, 2016 at 9:27am
Print Post  
Slavcho wrote on Oct 6th, 2016 at 4:30pm:
You should pass the arguments as a flat array, same way you would call Function.apply -

Code
Select All
...initializeBase(this, [parent, origin, destination]); 



Regards,
Slavcho
Mindfusion


Oh, that worked! I was following documentation in jsDiagramming component DiagraminkLink constructor is described like this:

Code (Javascript)
Select All
function DiagramLink ([parent, [origin, [destination]]])

 

  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3152
Joined: Oct 19th, 2005
Re: Anchoring problem
Reply #5 - Oct 7th, 2016 at 12:31pm
Print Post  
I think that's more of a notation about arguments being optional, rather that an array of arrays. Although we established they are not that optional when you need to implement serialization in the custom class Undecided
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint