dabeng / OrgChart

It's a simple and direct organization chart plugin. Anytime you want a tree-like chart, you can turn to OrgChart.
MIT License
2.86k stars 768 forks source link

(addChildren) : Cannot read properties of undefined (reading 'children') #706

Open ngomezleal opened 1 year ago

ngomezleal commented 1 year ago

Hello, I need your helps.

I'm trying add new children in node, and I'm receiving the following error: Cannot read properties of undefined (reading 'children')

I have the source data like example: var datasource = { 'name': 'Lao Lao', 'title': 'general manager', 'children': [ { 'name': 'Bo Miao', 'title': 'department manager' }, { 'name': 'Su Miao', 'title': 'department manager', }, ] }; ..... .on('click', function(event, data) { debugger; oc.addChildren($(this), { 'children': [ { 'name': 'Tie Hua', 'title': 'senior engineer' }, ]}) });


jquery.orgchart.js Line: 902

var url = $.isFunction(opts.ajaxURL.children) ? opts.ajaxURL.children($node.data('nodeData')) : opts.ajaxURL.children + $node[0].id;

Help please