This is a migrated thread and some comments may be shown as answers.

[Solved] get tree nodes that have a specific value

0 Answers 85 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Kevin
Top achievements
Rank 1
Kevin asked on 05 Nov 2010, 08:28 PM
I have an existing MVC page that shows a treeview.  Each tree view node has a unique value obviously. 

The page has a master grid of items.  Each time a user selects an item in the grid a button inside of an ajax form is clicked which causes a the form to post.  The postback currently retruns a partialview and I update the <div> html content with the returned html.  Everything works great. Using the TreeView sample (with checked nodes) as an example I implemented it.  Obviously The tree html is rendered in the partial view.  On the client side the html is replacedand the checked nodes of the newly are set for the newly selected item in the grid.  Works very well....but.....

My user base is complaining that the grid looses its state.  Obviously sinice the grid is being rebuilt inside of a partialview there is no good way to fix it. 

So i started down the path of instead of returning a partial view on the postback i would return a JsonResult from the postback and just return the checked nodes IDs.  The basic infrastructure is in place an working.  I am getting the checked node IDs from the Json object just perfectly in the onSuccess() callback of the post.  So now I need to check the nodes with the IDs returned.  I found an example to uncheck all of the checked nodes and that is working.

I can't find a way to use JQuery to return the list of checkboxes that correspond to the ids passed in the Json result.  If i need to loop for each id and do a queiry that is acceptable. I assume this is a simple query but since there are three <input>s and the id is stored in a hiden field i dont know enough about JQuery to easily get the proper items.  Can someone please help me with this simple request.

Kevin
Tags
TreeView
Asked by
Kevin
Top achievements
Rank 1
Share this question
or