Thanks Jeffrey. I solved issue# 1 almost similar way you suggested. But I am more concern about issue # 2. I am not sure about the flow. I want something like:
1) Click on Create Page link. I want to allow users to create data which will be internally displayed in <ul><li> elements and user can drag&drop and save the sequence. 2) Open dialog, enter data & Save. Here I am using $.ajax(). Bringing data from Action class in JSON datatype. 3) I will get data in success of $.ajax(). I can manipulate DOM, insert <ul><li> elements with data and similar way I can create child, subchild of the nodes. The problem here is: When I create children dynamically, I want to make sure if user clicks on "Refresh" button then also data should be retained on the page. In above case, it is not retaining because I am not sure how to go ahead with that. Should I capture "Refresh" event, fire event to the Action class, bring the data and show it on the page? Or is there any other alternative? How can I make sure that whatever data I am showing on the page is updated one and latest? Please advice. Thanks, Bhavin On Nov 22, 3:29 pm, "Jeffrey Kretz" <[EMAIL PROTECTED]> wrote: > 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:dynamictree/ 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- Hide quoted text - > > - Show quoted text -