I'm not 100% I understood your question, but I'll give it a shot. I have a dynamically rendered TreeView that is showing a page hierarchy, parent and child.
There is an option to add/remove pages, as well as drag them around. Because I need the id of the page and its parent, I render it in the HTML as an attribute. <li _pageid="132"> PageName1 <ul> <li _pageid="543">PageName2</li> <li _pageid="565">PageName3</li> </ul> </li> Database updates are handled as such: var li = $(this); var pageid = parseInt(li.attr('_pageid')); var parentid = parseInt(li.parents('li:first').attr('_pageid')); If I have a new set of child pages to render after an ajax call: var li = tree.find('li[_pageid='+pageid+']'); if (li.length) { var ul = li.children('ul'); if (!ul.length) ul = $('<ul></ul>').appendTo(li); ul.html(newchildnodes); } Does this help? JK -----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Bhavin Sent: Saturday, November 22, 2008 2:48 PM To: jQuery (English) Subject: [jQuery] Re: dynamic tree / treeview Anybody can guide me on this? On Nov 21, 12:55 am, Bhavin <[EMAIL PROTECTED]> wrote: > Hi > > I am using jquery to createtreestructure type of functionality > dynamically. I have to add nodes by opening dialog and save it into > the database. Once response is returned then I need to show it on the > page. I have few doubts here: > > 1) Once node is inserted into the database and response is rendered on > the page then how can I fetch id/value of the node. Here, DOM > shouldn't be updated automatically? I am not able to fetch parent node > id while adding child into it. > > 2) Once data is rendered on the page and if I refresh it then how > should I show thetreewhich was already created dynamically? Do I > need to bring all the data from the database by passing parentid? > > Please guide. > > Thanks, > Bhavin