How to set foucs on a particular node when using getorgchart

399 views Asked by At

I'm using this getorgchart library to generate organization chart in my application. I just want to highlight a particular node, i.e. the user who has logged in the application his node should be highlighted.

1

There are 1 answers

2
Suresh B On
// Code goes here

   var orgChart = new getOrgChart(document.getElementById("people"), {
            theme: "monica",
            primaryFields: ["name", "title"],
            photoFields: ["image"],
            gridView: true,
            linkType: "B",
            dataSource: [
                { id: 1, parentId: null, name: "Amber McKenzie", title: "CEO", phone: "678-772-470", mail: "[email protected]", adress: "Atlanta, GA 30303", image: "images/f-11.jpg" },
                { id: 2, parentId: 1, name: "Ava Field", title: "Paper goods machine setter", phone: "937-912-4971", mail: "[email protected]", image: "images/f-22.jpg" },
                { id: 3, parentId: 1, name: "Evie Johnson", title: "Employer relations representative", phone: "314-722-6164", mail: "[email protected]", image: "images/f-24.jpg" },
                { id: 6, parentId: 2, name: "Rebecca Randall", title: "Optometrist", phone: "801-920-9842", mail: "[email protected]", image: "images/f-8.jpg" },
                { id: 7, parentId: 2, name: "Spencer May", title: "System operator", phone: "Conservation scientist", mail: "[email protected]", image: "images/f-7.jpg" },
                { id: 8, parentId: 3, name: "Max Ford", title: "Budget manager", phone: "989-474-8325", mail: "[email protected]", image: "images/f-6.jpg" },
                { id: 9, parentId: 3, name: "Riley Bray", title: "Structural metal fabricator", phone: "479-359-2159", image: "images/f-3.jpg" }
            ],

            customize: {
                "1": { color: "green" },
                "2": { theme: "deborah" },
                "3": { theme: "deborah", color: "darkred" }
            }
        });

Here

customize: {
                    "1": { color: "green" },
                    "2": { theme: "deborah" },
                    "3": { theme: "deborah", color: "darkred" }
                }

u can customize for particular Id based on your login data id you can customize and make it highlight