This is a migrated thread and some comments may be shown as answers.

Layout finished event?

2 Answers 59 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Itai
Top achievements
Rank 1
Itai asked on 20 Jul 2016, 01:30 PM

The diagram `layout` method returns immediately while the layout process is on-going in the background.

It would be nice to have some way of knowing when the layout is finished, so I can show the user a "waiting" or "working" indication in the meanwhile. 

I couldn't find any `onLayoutFinished` in the API docs. Is there a way to know if the layout has finished processing? 

 

Thank you. 

2 Answers, 1 is accepted

Sort by
0
Accepted
Ianko
Telerik team
answered on 21 Jul 2016, 12:16 PM
Hello Itai,

I am afraid there is no such event, neither there is a possible built-in approach to handle this case. You can request such an improvement here: http://kendoui-feedback.telerik.com/forums/127393-kendo-ui-feedback.

Possible solution is to use an internal property that serves as a flag during Diagram processing the layout and an interval that fires your animation. Like so:
var diagram = $("#diagram").getKendoDiagram();
 
diagram.layout({
  type: "tree",
  subtype: "radial",
  verticalSeparation: 200,
  radialSeparation: 300,
  startRadialAngle: 20,
});
 
interval = setInterval(function(){
 console.log("loading")
  // start animation
 
  if(!diagram._layouting){
    window.clearInterval(interval);
  }
}, 15);

With the Diagram I used I was unable to experience so long delay for the layout to redraw itself. But I guess that you have great amount of shapes and connections that might cause a longer delay.

Regards,
Ianko
Telerik by Progress
 
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
 
0
Itai
Top achievements
Rank 1
answered on 23 Jul 2016, 08:22 AM

Thank you, this solution seems to be enough for my needs.  

 

Yes, the diagram has a few hundred nodes, and about as many connections. The problem is also most notable on slower machines, which is understandable. 

Tags
Diagram
Asked by
Itai
Top achievements
Rank 1
Answers by
Ianko
Telerik team
Itai
Top achievements
Rank 1
Share this question
or