I want build a structure like in the image below
But I need some help, look how far I did (don't worry about the names, the poblem is the Array)
I tryied the solution that I saw in this thread to convert an array to object but, without success, like you can see in the image below.
MY CODE
for (index = 0; index < result.length; index++) {
if (result[index].Parent_Id == 0) {
// Remove all white spaces from my Text.
var nome = result[index].Texto.replace(/ /g, '');
// Add a new component.
newMenu[nome] = {
name: result[index].Texto,
type: "item"
};
}
}
self.tree_data.push(newMenu);
self.treeDataSource2 = new DataSourceTree({ data: self.tree_data });
How can I do a structure like the first image ? The _data
in first image is a Object.
**