Simple HTML Node example not working replacing the template property

Hi,
I want use the diagram component with HTML Node.
I create the diagram, the HTML template and I add a node to the diagram.

The diagram is not showed as expected, infacted the jsRenderTemplate property are not replaced. It is showed just an empty node.
How i can specify the jsRender template property in the code-behind in the HtmlNode object?

My code-behind is:
Syncfusion.JavaScript.DataVisualization.Models.Diagram.HtmlNode node = new Syncfusion.JavaScript.DataVisualization.Models.Diagram.HtmlNode() { TemplateId = "htmlTemplate", Width = 140, Height = 50, BorderColor = "black", BorderWidth = 2, HorizontalAlign = HorizontalAlignment.Right, MarginLeft = 100, OffsetX= 300, OffsetY = 300};
var nodeInfo = new Dictionary<string, object>();
nodeInfo.Add("Name", "MyName");
node.AddInfo = nodeInfo;
myDiagram.Nodes.Add(node);

My jsrender template is
<script id="htmlTemplate" type="text/x-jsrender">
<div id="container">
<div id="name"><span>{{:Name}} </span></div>
</div>

</script>


d




   



1 Reply

SG Shyam G Syncfusion Team July 5, 2018 12:30 PM UTC

Hi Cosimo, 
 
Please use the modified code example(highlighted below) which binds the node addInfo property to an HTML template. Please refer to the sample below in which we have applied your code example to render an HTML node. 
 
Code example: 
    <script id="htmlTemplate" type="text/x-jsrender"> 
        <div id="container"> 
            <div id="name"><span>{{:addInfo.Name}} </span></div> 
        </div> 
    </script> 
 
 
Regards, 
Shyam G 


Loader.
Up arrow icon