- Welcome, Guest. Please Login or Register
MindFusion  
  We have released initial version of MindFusion.JavaScript pack. It includes chart, diagram, calendar, map, virtual keyboard, gauge and UI components. Here are more details and live demo for anyone interested.  
  HomeHelpSearchLoginRegister   
     
     
   
 
Page Index Toggle Pages: 1 Send Topic Print  
Collapse and keep nodes with multi incoming links
Read 2436 times

Ghaith   Offline
YaBB Newbies
*
Posts: 21
I Love MindFusion!


   
     
 
Collapse and keep nodes with multi incoming links
May 23rd, 2017 at 8:15pm
 
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
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1865
Gender: male
tech.support


   
     
 
Re: Collapse and keep nodes with multi incoming links
Reply #1 - May 23rd, 2017 at 9:35pm
 
Hi,

Try handling treeCollapsed event like this -

Code:
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
 
 
 
IP Logged    
 
     

Ghaith   Offline
YaBB Newbies
*
Posts: 21
I Love MindFusion!


   
     
 
Re: Collapse and keep nodes with multi incoming links
Reply #2 - May 24th, 2017 at 6:46pm
 
Thanks dear it worked.
 
 
 
IP Logged    
 
     

Ghaith   Offline
YaBB Newbies
*
Posts: 21
I Love MindFusion!


   
     
 
Re: Collapse and keep nodes with multi incoming links
Reply #3 - Jun 2nd, 2017 at 3:22pm
 
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:
//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
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1865
Gender: male
tech.support


   
     
 
Re: Collapse and keep nodes with multi incoming links
Reply #4 - Jun 5th, 2017 at 8:57am
 
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.
 
 
 
IP Logged    
 
     

Ghaith   Offline
YaBB Newbies
*
Posts: 21
I Love MindFusion!


   
     
 
Re: Collapse and keep nodes with multi incoming links
Reply #5 - Jun 5th, 2017 at 12:42pm
 
Dear,

Thanks for you reply,  but I don't have LoadFromJson function.
I have the following
LoadFromFile
LoadFromStream
LoadFromString
LoadFromXml
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1865
Gender: male
tech.support


   
     
 
Re: Collapse and keep nodes with multi incoming links
Reply #6 - Jun 5th, 2017 at 2:06pm
 
It's in DiagramView class, since version 5.7.
 
 
 
IP Logged    
 
     

Ghaith   Offline
YaBB Newbies
*
Posts: 21
I Love MindFusion!


   
     
 
Re: Collapse and keep nodes with multi incoming links
Reply #7 - Jun 5th, 2017 at 4:45pm
 
Dear,

how to check the current version? and how to upgrade to V 5.7?
I have a licensed version.
 
 
 
IP Logged    
 
     

Slavcho   Offline
God Member
*****
Posts: 1865
Gender: male
tech.support


   
     
 
Re: Collapse and keep nodes with multi incoming links
Reply #8 - Jun 5th, 2017 at 6:06pm
 
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.
 
 
 
IP Logged    
 
     

Ghaith   Offline
YaBB Newbies
*
Posts: 21
I Love MindFusion!


   
     
 
Re: Collapse and keep nodes with multi incoming links
Reply #9 - Jun 7th, 2017 at 3:50pm
 
after updating, everything worked perfectly.

thanks for your support
 
 
 
IP Logged    
 
     
Page Index Toggle Pages: 1 Send Topic Print