[CLOSED] Hide Tree Panel Node in Razor

  1. #1

    [CLOSED] Hide Tree Panel Node in Razor

    Hello

    I have a simple tree panel and wish to use server processing to decide if certain nodes should be presented to the user. Some nodes always will, some will not.

    Here is my example
    @{
        Layout = "_BaseLayout.cshtml";
        var X = Html.X();   
    }
    @section example
    {
        @(
     Html.X().Viewport()
            .Items(
                (
            X.TreePanel()
                .ID("treePanel")
                .Width(300)
                .RootVisible(false)
                .Root(
                    X.Node()
                     .Text("Configuration")
                     .Expanded(true)
                     .Expandable(false)
                     .Children(
                        X.Node()
                            .Text("Areas")
                            .Expanded(true)
                            .Expandable(true)
                            .Children(                        
                                X.Node().Text("Area A").Leaf(true),
                                X.Node().Text("Area B").Leaf(true),
                                X.Node().Text("Area C").Leaf(true)
                            )     
                     )
                )
                )      
            )
        )
    }
    However, I cannot find a way to do something like
    X.Node().Text("Area A").Leaf(true).Visible(Model.Permissions.AreaA)
    Maybe their is something I missing about how to use the Razor Syntax within the Children collection.

    Thank you for your help.
    Last edited by Baidaly; Nov 16, 2013 at 12:25 AM. Reason: [CLOSED]
  2. #2
    Hello!

    Unfortunately, there is no default way to do this. However, you can try the approach from this thread: http://forums.ext.net/showthread.php?19505
  3. #3
    Wow, thank you for the very quick response. Your link lead me to other information which lead me to loading the nodes via a controller, which will work for what I need.

    http://mvc.ext.net/#/TreePanel_Advanced/Remote_Mode/

    Thank you

Similar Threads

  1. How expand Perticular Tree panel Node
    By Binai in forum 1.x Help
    Replies: 0
    Last Post: May 15, 2013, 8:56 AM
  2. Replies: 1
    Last Post: Oct 26, 2012, 8:52 AM
  3. add node to tree panel
    By a_elsayed2010 in forum 1.x Help
    Replies: 0
    Last Post: Oct 17, 2010, 2:35 PM
  4. [CLOSED] Tree Panel: Buttons on each node
    By gokcemutlu in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: May 25, 2009, 9:55 AM
  5. Selected Node - tree panel
    By filipator in forum 1.x Help
    Replies: 3
    Last Post: Mar 25, 2009, 2:58 PM

Tags for this Thread

Posting Permissions