I wanted to create an dynamic chart using getorgchart API, but i am having one problem in showing the datasource in jquery attribute.I have done iteration in JSP and set datasource value what i want to display, but this is not working.Can anybody help . please check the attached code.

var markerArrow = ' ';

var dataSource1 = "";
 <c:forEach items="${resultModel.result}" var="result" varStatus="status">
    dataSource1 = dataSource1.concat("{ id: " + ${result.employeeName} +", parentId: " + ${result.reportingTo} +", Name: " + "${result.toolTip}" +"},")
 </c:forEach> 
    alert(dataSource1);
    $("#people").getOrgChart({      
        primaryColumns: ["Name"],
        orientation: getOrgChart.RO_TOP, 
        embededDefinitions: markerArrow,
        dataSource: [dataSource1],
    });
</script>   

1

There are 1 best solutions below

0
On

I don't use JSP in particular, but for GetOrgChart, in your datasource, each 'id' and 'parentId' must be a number (or null); not an employee name. Add each id in a topdown manner of hierarchy.