hi my project is
i have to create id, parent id , Name in database
this is my database
id Parentid Name
---------------------
1 0 A
2 1 B
3 1 C
4 0 D
5 4 E
6 4 F
7 0 G
now i should get output as
A D G
------------
B E
C F
if i add any more main menus are sub menus automatically it should take.
i have used json my code is
this is my view page
---------------------
script type="text/javascript">
var url = '/home/get'
$.ajax({ type: "get",
url: url,
datatype: "json",
error: function (xhr, status, error) {
alert(error);
},
success: function (json) {
var g = json.st.length;
alert("displaying values: " + g);
var menu = new dhtmlXMenuObject("menuObj");
{
for (i = ((json.st.length) - 1); i >= 0; i--) {
alert("displayed data: " + json.st);
menu.addNewSibling(null, "a", json.st[i], false);
{
if(json.r[i].id == json.r[i].Parentid)
{
menu.addNewChild("a", 0, "new", json.r[i], false);
}
else
{
menu.addNewChild("b", 0, "file", json.r[i], false);
}
alert("displaying data: " + json.r);
}
}
}
});
</script>
</head>
but im getting out put
A D G
------------
B
C
i am not getting the secong main menu item
i couldn't able to get submenus from main menu D G etccc
so plaese suggest if there is any step to proceed
Thank you