Layout finished event?

3 posts, 1 answers
  1. Itai
    Itai avatar
    33 posts
    Member since:
    Feb 2016

    Posted 20 Jul Link to this post

    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. Answer
    Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 21 Jul Link to this post

    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.
     
  3. Kendo UI is VS 2017 Ready
  4. Itai
    Itai avatar
    33 posts
    Member since:
    Feb 2016

    Posted 23 Jul in reply to Ianko Link to this post

    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. 

Back to Top