BasicPrimitives / react

Basic Primitives Diagrams for React. Data visualization components library that implements organizational chart and multi-parent dependency diagrams.
https://basicprimitives.github.io/react/
Other
22 stars 5 forks source link

Cannot set properties of undefined (setting 'id') in OrgItemConfig() #70

Closed iFlameDev closed 1 year ago

iFlameDev commented 1 year ago

Hi all, I found a confusing issue inside OrgItemConfig

image this is where I create the OrgItemConfig object

image and this is the result in the console log

image on the 6.5.1 version inside React project

I don't have any idea about this error, please help me.

BasicPrimitives commented 1 year ago

You have to use new OrgItemConfig(arguments ....) construct or provide a regular JSON objects instead.

control.setOptions({"items", [
    new primitives.OrgItemConfig({
        id: 0,
        parent: null,
        title: "James Smith",
        description: "VP, Public Sector",
        image: "../images/photos/a.png"
    }),
    new primitives.OrgItemConfig({
        id: 1,
        parent: 0,
        title: "Ted Lucas",
        description: "VP, Human Resources",
        image: "../images/photos/b.png"
    }),
    new primitives.OrgItemConfig({
        id: 2,
        parent: 0,
        title: "Fritz Stuger",
        description: "Business Solutions, US",
        image: "../images/photos/c.png"
    })
]
});