Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Collapse and keep nodes with multi incoming links (Read 7106 times)
Ghaith
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Apr 7th, 2017
Collapse and keep nodes with multi incoming links
May 23rd, 2017 at 7:15pm
Print Post  
Hello,

I have a diagram with custom Nodes, and there might be more than one parent to some nodes,
in the collapse of parent, then then child node is hidden even if there is other link,

I want to validate if there is more than one visible IncommingLinks to the child, then keep the child visible.

I tried to set the visible = true to the child node  in TreeCollapsed handler, but it didn't work.

Tried to implement a custom ExpandButtonClicked, but didn't success.

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


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Collapse and keep nodes with multi incoming links
Reply #1 - May 23rd, 2017 at 8:35pm
Print Post  
Hi,

Try handling treeCollapsed event like this -

Code
Select All
function onTreeCollapsed(sender, args)
{
	var node = args.node;
	if (node.collapsedSet)
	{
		node.collapsedSet.forEach(function (item)
		{
			if (item == node)
				return;
			if (DiagramNode.isInstanceOfType(item))
			{
				var links = item.incomingLinks;
				var expandBack = false;
				links.forEach(function (link)
				{
					if (link.getVisible())
						expandBack = true;
				});
				if (expandBack)
				{
					item.setVisible(true);
					item.expand();
				}
			}
		});
	}
} 



Regards,
Slavcho
  
Back to top
 
IP Logged
 
Ghaith
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Apr 7th, 2017
Re: Collapse and keep nodes with multi incoming links
Reply #2 - May 24th, 2017 at 5:46pm
Print Post  
Thanks dear it worked.
  
Back to top
 
IP Logged
 
Ghaith
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Apr 7th, 2017
Re: Collapse and keep nodes with multi incoming links
Reply #3 - Jun 2nd, 2017 at 2:22pm
Print Post  
Dear,

I had the same issue when exporting the diagram using PdfExporter, since I had to recreate the diagram in server side, I write a code to re-collapse collapsed nodes, but I couldn't keep the nodes with multi incoming links

here is my code, where I passed the diagram json value to server

Code
Select All
//Draw diagram
            FillSelectedEntity();

            var json_value = Request.Form["diagram_json"];

            if (!string.IsNullOrWhiteSpace(json_value))
            {
                var j_diagram = Json_Diagram.Deserialize(json_value);
                for (int i = 0; i < this.diagramView.Diagram.Items.Count; i++)
                {
                    var t = j_diagram.items.SingleOrDefault(x => x.instanceId == i);
                    if (t == null)
                        continue;

                    var item = this.diagramView.Diagram.Items[i];
                    //Node
                    if (item.Id != null)
                    {
                        var n = item as CustomNode;
                        n.Move(t.bounds.x, t.bounds.y);
                        if (!t.expanded)
                            n.Collapse();
                    }
                }
                this.diagramView.Diagram.RouteAllLinks();
                ResizeDiagramView();
            }
 


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


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Collapse and keep nodes with multi incoming links
Reply #4 - Jun 5th, 2017 at 7:57am
Print Post  
Instead of rebuilding the diagram, you should be able to send serialized full diagram from client to server. Try calling Diagram.toJson() in JavaScript and DiagramView.LoadFromJson on .NET side, then the visibility of items should be as set in the client-side handler.
  
Back to top
 
IP Logged
 
Ghaith
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Apr 7th, 2017
Re: Collapse and keep nodes with multi incoming links
Reply #5 - Jun 5th, 2017 at 11:42am
Print Post  
Dear,

Thanks for you reply,  but I don't have LoadFromJson function.
I have the following
LoadFromFile
LoadFromStream
LoadFromString
LoadFromXml
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Collapse and keep nodes with multi incoming links
Reply #6 - Jun 5th, 2017 at 1:06pm
Print Post  
It's in DiagramView class, since version 5.7.
  
Back to top
 
IP Logged
 
Ghaith
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Apr 7th, 2017
Re: Collapse and keep nodes with multi incoming links
Reply #7 - Jun 5th, 2017 at 3:45pm
Print Post  
Dear,

how to check the current version? and how to upgrade to V 5.7?
I have a licensed version.
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3146
Joined: Oct 19th, 2005
Re: Collapse and keep nodes with multi incoming links
Reply #8 - Jun 5th, 2017 at 5:06pm
Print Post  
Check the readme.txt or properties of diagramming.webforms.dll. If your license was purchased within a year before the v5.7 release, the license key will work for 5.7 too.
  
Back to top
 
IP Logged
 
Ghaith
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Apr 7th, 2017
Re: Collapse and keep nodes with multi incoming links
Reply #9 - Jun 7th, 2017 at 2:50pm
Print Post  
after updating, everything worked perfectly.

thanks for your support
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint