nested set and treeview control
Given the following database tables and sample data:
Locations
Id ParentId LeftIndex RightIndex Description
-- -------- --------- ---------- -----------
34 2 85 104 Florida Region
73 34 94 95 Miami
Products
Id ParentLocationId Code Description
-- ---------------- ---- -----------
1 73 MIW0 Miami Magazines
I'm using a nested set for my hierarchy data. What I'm trying to do is display my locations and products together in a c开发者_开发百科ollapsible tree view control. Will I somehow have to combine the tables before proceeding? Please advise in all areas (see tags)
Thanks,
rod.
I would recommend you create a ModelView that you map your domain models into in your controller. For example, something like
public class TreeViewEntry {
public string Name { get; set; }
public TreeViewEntry[] Children { get; set; }
}
and then take a look at this page for a jQuery plugin and HTML helper: http://www.matthidinger.com/archive/2009/02/08/asp.net-mvc-recursive-treeview-helper.aspx
精彩评论