Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic MindFusion.Diagramming.Diagram.find(...) keeps returning null (Read 1162 times)
jose_au
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 3
Joined: Apr 10th, 2020
MindFusion.Diagramming.Diagram.find(...) keeps returning null
Mar 31st, 2022 at 5:56am
Print Post  
I seem to have this issue where MindFusion.Diagramming.Diagram.find() returns null most of the time.

I am able to replicated it using Tutorial2.

Just add the following code after @RenderSection() of _Layout.cshtml

<script>
$(document).ready(function () {
var diagram = MindFusion.Diagramming.Diagram.find('diagramView1');
console.log(diagram);
});
</script>

Some more info:

Browser cache is disabled.

Using Version 3.3.1

Compiling using Core 3.1 project.
  

_Layout.cshtml ( 3 KB | 109 Downloads )
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3155
Joined: Oct 19th, 2005
Re: MindFusion.Diagramming.Diagram.find(...) keeps returning null
Reply #1 - Mar 31st, 2022 at 9:08am
Print Post  
Maybe the diagram hasn't loaded yet during document.ready event, depending on html structure and script elements' order. Try using diagram's own ControlLoaded event instead -

Code
Select All
@Html.DiagramView(((DiagramView)ViewBag.DiagramView)
            .ControlLoadedScript("diagramLoad")

<script type="text/javascript">
    function diagramLoad(sender)
    {
        console.log(sender);
    }
</script> 



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


I Love MindFusion!

Posts: 3
Joined: Apr 10th, 2020
Re: MindFusion.Diagramming.Diagram.find(...) keeps returning null
Reply #2 - Apr 6th, 2022 at 3:45am
Print Post  
We suspected as much. We hooked into the .ControlLoadedScript() event and carried on from there.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint