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

[Solved] Any examples of a Menu Maintenance Hierarchy Project?

1 Answer 61 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.
Reid
Top achievements
Rank 2
Reid asked on 10 Dec 2011, 05:29 PM
Hello all,

I am just starting out using the TreeView to load menu items for the backend CMS so that they can be maintained.  In the process, of course the menu items will need to cascade into nodes and nested nodes.  I will need JavaScript, JQuery to obtain the selected node when the "Apply" button or "Submit" button is clicked in the View.  Also the abilty to insert a node and name it.

What makes this a bit complicated is that conceptually it seems as though the right tactic would be to use the right view model that contained the other properties needed to pin to each Node (ModelMenuItem in the model) or menu item. That schema in the database and on the object contain a ControllerName and Controller action that works fine right now in loading the Telerik Menu with the MenuIndexModel class (found in a demo here).  So I need to associate and record the properties the user fills in in a <div> for the menu object so that as they traverse the tree and do their work I can provide an "Apply" button as they go and then just wait until the save button is clicked to commit.  At that thime I think flushing and recreating the MenuItem table in the database would be prudent.

Any examples of traversing the tree in Jquery and rebuilding a Hierarchy of menu items (Site Map whatever it may be) would be greatly appreciated.

I know there are examples of using the site map for the menu source which is fine, but nt the direction I took for other reasons.

I also want to allow that view eventually to contain a RadEditor so that the users can edit the MegaMenu content if desired.

Does anyone have any conceptual points or example code to help expedite this part of the solution?  Even if my approach is not right to begin with.

Much appreciated, Thanks!


Reid

1 Answer, 1 is accepted

Sort by
0
Alex Gyoshev
Telerik team
answered on 13 Dec 2011, 10:47 AM
Hello Reid,

> the abilty to insert a node and name it.
Currently, the ASP.NET MVC TreeView extension does not support adding and editing nodes on the client-side. We have planned to introduce client-side APIs for adding and removing items with Q1.2012. Node editing is not yet planned. You can work-around the limitations by rebinding the treeview through the dataBind() method (client-side, with JSON), or request the data from the server with ajaxRequest(). There are examples of how they are used in the treeview documentation.

> obtain the selected node
You can obtain the currently selected node with the following jQuery selector: $(".t-in.t-state-selected"). Its text can be retrieved with the following: $(".t-in.t-state-selected").text().

All the best,
Alex Gyoshev
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
Tags
TreeView
Asked by
Reid
Top achievements
Rank 2
Answers by
Alex Gyoshev
Telerik team
Share this question
or