Hi everyone, I have created a multidimensional array which is dynamically will change with different depths.That why I'm not use usual way to create a static looping process.
So,the problem here I can't to delete selected object in that array.
Example array before delete particular object
var data = [
{
id:"43",
text: 'Parent 1'
},
{
id:"55",
text: 'Parent 2',
nodes: [
{
id:"57",
text: 'Child 1',
nodes: [
{
id:"56",
text: 'Child sub 2'
},
{
id:"50",
text: 'Child sub 3'
}
]
}
]
},
{
id:"47",
text: 'Parent 3',
nodes: [
{
id:"48",
text: 'Child 2'
}
]
}
]
if I selected setence object for example,current array will remain as below
{
id:"50",
text: 'Child sub 3'
}
Expected result
var data = [
{
id:"43",
text: 'Parent 1'
},
{
id:"55",
text: 'Parent 2',
nodes: [
{
id:"57",
text: 'Child 1',
nodes: [
{
id:"56",
text: 'Child sub 2'
}
]
}
]
},
{
id:"47",
text: 'Parent 3',
nodes: [
{
id:"48",
text: 'Child 2'
}
]
}
]
The example code in my jsfiddle