PDA

View Full Version : [CLOSED] Hide Tree Panel Node in Razor



Patrick_G
Nov 15, 2013, 6:03 PM
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.

Baidaly
Nov 15, 2013, 8:25 PM
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

Patrick_G
Nov 16, 2013, 12:14 AM
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