Search code examples
javascriptphpjqueryorgchartgetorgchart

getOrgChart.js for a supply chain


I am trying to create a supply chain in a web page

enter image description here

For that I use the getOrgChart plugin. The problem is that they only allowed me to create children from a parent node, and for my problem, they helped me to make my clients become my suppliers.

enter image description here

As you can see, I can only show my suppliers and the company in one getorgchart, and the same company with its clients in another getorgchart. My goal is to show everything in a single getorgchart. Excuse my English, I'm Spanish. Greetings.

the code js.

 <div   id="people"></div>
 <div   id="people2"></div>
 <script type="text/javascript">
                  $(document).ready(function(){
                    $.getJSON("listaproCS.php",function(source){
                        
                      console.log(source);

                      var peopleElement = document.getElementById("people");
                      var orgChart = new getOrgChart(peopleElement, {
                         enableEdit: false,
                         enableDetailsView: false,
                         primaryFields: ["nombre"],
                         photoFields: ["imagen"],
                         orientation: getOrgChart.RO_RIGHT,
                         dataSource : source
                         });
                    });

                    $.getJSON("listaclieCS.php",function(data){
                      console.log(data);
                      var peopleElement = document.getElementById("people2");
                      var orgChart = new getOrgChart(peopleElement, {
                         enableEdit: false,
                         enableDetailsView: false,
                         primaryFields: ["nombre"],
                         photoFields: ["imagen"],
                         orientation: getOrgChart.RO_LEFT,
                         dataSource : data
                       });
                    });
                   });
 </script>

The data that I get through JSON, I show them in console

enter image description here


Solution

  • Multi parent is not supported in the current version