使用Ajax读取节点OrgChart

i Use OrgChart.js (BalkanGraph), and i Read my data from sql server with Ajax but i don't know how i show my nodes of Orgchart. enter image description here

this is my script :

 <script >

            var chart = new OrgChart(document.getElementById("tree"), {

                nodeBinding: {
                    field_0: "UO",
                    field_1:"Uo_Rattachement"
                },
                menu: {
                    pdf: { text: "Export PDF" },
                    png: { text: "Export PNG" },
                    svg: { text: "Export SVG" },
                    csv: { text: "Export CSV" }
                },
                nodeContextMenu: {
                    edit: { text: "Edit", icon: OrgChart.icon.edit(18, 18, '#039BE5') },
                    add: { text: "Add", icon: OrgChart.icon.add(18, 18, '#FF8304') }
                },


                nodeMenu: {
                    details: { text: "Details" },
                    edit: { text: "Edit" },
                    add: { text: "Add" },

                    remove: { text: "Remove" }
                },
                nodes: []


            });

            $.ajax({ 
                type: "POST",
                url: "WebForm1.aspx/ReadData",
                //data: ( list),
                dataType: "json",
                contentType: "application/json",
                traditional: true,
                success: function (response) {
                    if (response != null && response.d != null) {
                        var data = response.d;//this data already is json which represent list of Node so that you can iterate with each
                        $.each(data, function (index, node) {
                            console.log(node);
                        });
                    }
                }
            });

i need to show my data as nodes of orgchart, how can i do it !! thank u

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐