Skip to main content

ASPxClientDiagramCustomShapeCreateTemplateEventArgs.item Property

Gets the currently processed diagram item.

Declaration

item: DiagramShape

Property Value

Type Description
DiagramShape

The diagram shape object.

Remarks

<script>
function onCustomShapeCreateTemplate(s, e) {
    var department = getDepartment(e.item.key);
    var svgNS = "http://www.w3.org/2000/svg"
    var svgEl = document.createElementNS(svgNS, "svg");
    svgEl.setAttribute("class", "template");
    e.container.appendChild(svgEl);
    var textEl = document.createElementNS(svgNS, "text");
    textEl.setAttribute("class", "template-name");
    textEl.setAttribute("x", "50%");
    textEl.setAttribute("y", "35%");
    textEl.textContent = department.DepartmentName;
    svgEl.appendChild(textEl);
    var btnEl = document.createElementNS(svgNS, "text");
    btnEl.setAttribute("class", "template-button");
    btnEl.setAttribute("x", "50%");
    btnEl.setAttribute("y", "75%");
    btnEl.textContent = "Show Details";
    btnEl.onclick = function() { showInfo(department); };
    svgEl.appendChild(btnEl);
}
</script>

<dx:ASPxDiagram ID="Diagram" ClientInstanceName="diagram" runat="server" ...>
    <ClientSideEvents CustomShapeCreateTemplate="onCustomShapeCreateTemplate" />
...

Run Demo: Templates

See Also