weixin_33736649
2020-02-24 09:38
采纳率: 0%
浏览 150

使用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

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

相关推荐 更多相似问题