I have an array in javascript:
var elements = [ // original hierarhical array to display
{key:10, label:"Web Testing Dep.", open: true, children: [
{key:20, label:"Elizabeth Taylor"},
{key:30, label:"Managers", children: [
{key:40, label:"John Williams"},
{key:50, label:"David Miller"}
]},
{key:60, label:"Linda Brown"},
{key:70, label:"George Lucas"}
]},
{key:110, label:"Human Relations Dep.", open:true, children: [
{key:80, label:"Kate Moss"},
{key:90, label:"Dian Fossey"}
]}
];
If I want to add a whole new element I can use a push(). But I want to add a part of an element.
for exemple I want to add
var toAdd = {key:100, label:"Johny Dep"}
To the children of key 10 "web testing dep.".
Is it also possible with a push()?