Jun 09, 2014, 7:01 AM
App.direct undefined
Hello
Please help me. I am trying some basic examples. Here I have a problem with App.direct which is undefined. Here is my code for controller:
)
Also could you tell me where can I find ~/resources/css/examples.css which is refered to in samples
Please help me. I am trying some basic examples. Here I have a problem with App.direct which is undefined. Here is my code for controller:
using Ext.Net;
using Ext.Net.MVC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace DA.Controllers
{
[DirectController(AreaName = "DA", GenerateProxyForOtherControllers = false, IDMode = DirectMethodProxyIDMode.None)]
public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}
[DirectMethod]
public ActionResult NodeLoad(string node)
{
NodeCollection nodes = new Ext.Net.NodeCollection();
if (!string.IsNullOrEmpty(node))
{
for (int i = 1; i < 6; i++)
{
Node asyncNode = new Node();
asyncNode.Text = node + i;
asyncNode.NodeID = node + i;
nodes.Add(asyncNode);
}
for (int i = 6; i < 11; i++)
{
Node treeNode = new Node();
treeNode.Text = node + i;
treeNode.NodeID = node + i;
treeNode.Leaf = true;
nodes.Add(treeNode);
}
}
return this.Direct(nodes);
}
}
}
and here is a view@{
ViewBag.Title = "Viewport with BorderLayout - Ext.NET MVC Examples";
Layout = "~/Views/Shared/_BaseLayout.cshtml";
var X = Html.X();
}
@section headtag
{
<script>
var nodeLoad = function (store, operation, options) {
var node = operation.node;
App.direct.NodeLoad(node.getId(), {
success: function (result) {
node.set('loading', false);
node.set('loaded', true);
node.appendChild(result);
node.expand();
},
failure: function (errorMsg) {
Ext.Msg.alert('Failure', errorMsg);
}
});
return false;
};
</script>
}
@section example
{
@(X.Viewport()
.Layout(LayoutType.Border)
.Items(
X.Panel().Title("West").Region(Region.West).Layout(LayoutType.Accordion).Width(225).MinWidth(225).MaxWidth(400).Split(true).Collapsible(true)
.Items(
X.TreePanel().Title("Navigation").Border(false).BodyPadding(6).Icon(Icon.FolderGo).Root(Html.X().Node().NodeID("0").Text("Root")).Listeners(l => { l.BeforeLoad.Fn = "nodeLoad"; }),
//X.TreePanel().Title("Navigation").Border(false).BodyPadding(6).Icon(Icon.FolderGo).Root(Html.X().Node().NodeID("0").Text("Root")).DirectEvents(de => { de.BeforeLoad.Url = "Home/Test"; }),
X.Panel().Title("Settings").Border(false).BodyPadding(6).Icon(Icon.FolderWrench).Html("Some settings in here")
),
X.TabPanel().Region(Region.Center).Items(
X.Panel()
.Title("Main")
.Border(false)
.BodyPadding(6)
)
)
)
}
I want to mention that part under comment (with "DirectEvents(de => { de.BeforeLoad.Url = "Home/Test"}) is working, only I don't know how to send parameters in that case...)
Also could you tell me where can I find ~/resources/css/examples.css which is refered to in samples