Uncaught TypeError: Cannot read property 'children' of undefined

5,676 views
Skip to first unread message

AmosG

unread,
Jul 11, 2014, 1:18:35 PM7/11/14
to jst...@googlegroups.com
So, I have 1500+ data to be put into the list. 

I using data in this format in order to benefit the automatic arrangement.

'data' : [
                   { 'id' : 'ajson3', 'parent' : '#', 'text' : 'Child 1' },
                   { 'id' : 'ajson4', 'parent' : '#', 'text' : 'Child 2' },
                   { 'id' : 'ajson5', 'parent' : '#', 'text' : 'Child 2' },
                   { 'id' : 'ajson6', 'parent' : '#', 'text' : 'Child 1' },
                   { 'id' : 'ajson7', 'parent' : '#', 'text' : 'Child 1' }
]

 However, I am receiving the "Uncaught TypeError: Cannot read property 'children' of undefined " error. Is there anything that needs to be considered?
Thanks in advanced,
Amos.

Ivan Bozhanov

unread,
Jul 11, 2014, 5:08:16 PM7/11/14
to jst...@googlegroups.com
You probably have an error in your structure - non existent parent for example.

Best regards,
Ivan

AmosG

unread,
Jul 15, 2014, 11:35:46 AM7/15/14
to jst...@googlegroups.com
Yup, there is one data that doesn't have the parent and it's working now. thanks.

Trent Allday

unread,
Feb 18, 2016, 9:01:50 AM2/18/16
to jsTree
Is there anyway in jsTree for it handle these orphan nodes e.g. If parent doesnt exist just put a root level 
Reply all
Reply to author
Forward
0 new messages