Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
680
Tree not showing up
posted

I'm trying to display a tree in ASP.NET MVC4

This is the HTML that's rendered, but I see nothing:

 

    $("#sidebar_menuTree").igTree({         singleBranchExpand: false,         bindings: {             textKey: 'Title',             valueKey: 'MenuId',             childDataProperty: 'Children',             bindings: {                 textKey: 'Title',                 valueKey: 'MenuId',             }         },         dataSourceType: 'json',         dataSource: [{"MenuId":"MainMenu","Title":"Main Menu","Description":"Parent to all menus","Url":"~/","Sequence":0,"Children":[{"MenuId":"MenuEditor","Title":"Menu Editor","Description":"GEMS Menu Editor","Url":"~/MenuEditor","Sequence":100,"Children":[]}]}]         });

(BTW, how do I post code here so it doesn't look horrible?)

This is the actual partial view that contains the tree:

 <script type="text/javascript">     $("#sidebar_menuTree").igTree({         singleBranchExpand: false,         bindings: {             textKey: 'Title',             valueKey: 'MenuId',             childDataProperty: 'Children',             bindings: {                 textKey: 'Title',                 valueKey: 'MenuId',             }         },         dataSourceType: 'json',         dataSource: @Html.Raw(GEMS.Web.Models.MainMenuReadOnlyModel.GetMenuItemsAsJSON())         });     </script> <div id="sidebar_menuTree">     </div>

 

Of course, it was formatted a lot nicer before I pasted it here (looks fine in notepad and any other editor).

 

 

 

 

  • 680
    Suggested Answer
    posted

    Nevermind. Too many straight hours of coding. I deleted the $(document).ready(...) stuff that was surrounding it.