Skip to content

Options parentPropety not working as expected #20

Open
@immersivevreducation

Description

@immersivevreducation

hi guys, he's the issue I'm facing using parentProperty options.

var data2 =[
{
id: 1,
created_at: '2020-05-09T16:13:04.896Z',
folder_id: 1,
'Filess.name': 'MyFirstLesson'
},
{
id: 2,
created_at: '2020-05-11T16:13:04.896Z',
folder_id: 2,
'Filess.name': 'MyFirstLesson'
},
{
id: 3,
created_at: '2020-05-11T16:13:04.896Z',
folder_id: 3,
'Filess.name': 'MyFirstLesson'
},
{
id: 4,
created_at: '2020-05-09T16:13:04.896Z',
folder_id: 1,
'Filess.name': 'Meeting1'
},
{
id: 5,
created_at: '2020-05-16T16:13:04.896Z',
folder_id: 1,
'Filess.name': 'SetupRoom'
},
{
id: 6,
created_at: '2020-05-17T16:13:04.896Z',
folder_id: 1,
'Filess.name': 'SetupRoom'
},
{
id: 7,
created_at: '2020-05-17T16:13:04.896Z',
folder_id: 1,
'Filess.name': 'SetupRoom'
},
{
id: 8,
created_at: '2020-05-20T15:26:36.656Z',
folder_id: 1,
'Filess.name': 'Annotation 2020-04-08 135240.jpg'
}
]

arrayToTree(data2, {parentProperty: 'folder_id})

returns empty array

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions