PDA

View Full Version : [CLOSED] Tree Panel Razor View Example?



machinableed
Feb 28, 2012, 3:12 AM
Hi there,

I need to create a tree panel (in a razor view page) but can't figure out the syntax - I can't find a way to achieve the

<Root>
<ext:Node>
<Children>
<ext:Node>

part of the structure. Any chance of an example of how to create a tree panel in razor view syntax? Specifically how to create the nodes/children?

thanks

Vladimir
Feb 28, 2012, 11:06 AM
Unfortunately, Developer Preview 1 doesn't allow it
We added that option to SVN already, please wait Beta release (should be soon)

Here is a sample


@(Html.X().TreePanel()
.Root(root => (
root.Add(new Node{
Text = "Root"
});
))
)

machinableed
Feb 29, 2012, 2:57 AM
I assume this is the same case with many of the controls? It appears you can't add items to combo boxes etc. either in Razor view?

Vladimir
Feb 29, 2012, 10:08 AM
Hi,

We will appreciate if you post all known problems with Razor, it will allow us to fix it before beta release

machinableed
Feb 29, 2012, 10:27 AM
The others I've noticed so far are the combobox and multibox don't appear to have items collections exposed so its not possible to add anything to them.

Vladimir
Feb 29, 2012, 6:05 PM
Items of Combobox/MultiSelect are now supported by Razor engine
It will be availbale in next beta release

machinableed
Mar 09, 2012, 3:48 AM
Unfortunately, Developer Preview 1 doesn't allow it
We added that option to SVN already, please wait Beta release (should be soon)

Here is a sample


@(Html.X().TreePanel()
.Root(root => (
root.Add(new Node{
Text = "Root"
});
))
)


Sorry - I'm having a little bit of trouble with this. What is the syntax to then add child elements to the root node?

Daniil
Mar 09, 2012, 9:22 AM
Here you are.

Example

@{
Layout = "";
}
<!DOCTYPE html>
<html>
<head>
<title>Ext.Net.MVC v2 Example</title>
</head>
<body>
@Html.X().ResourceManager()

@(Html.X().TreePanel()
.Height(200)
.Root(root =>
{
root.Add(new Node
{
Text = "Root"
});
root[0].Children.Add(new Node()
{
Text = "Node 1",
Leaf = true
});
root[0].Children.Add(new Node()
{
Text = "Node 2",
Leaf = true
});
})
)
</body>
</html>