Jan 13, 2015, 8:55 AM
Please clarify where is the Window defined? Inside the parent page or the child one?
return this.PartialExtView(
viewName: "Edit",
model: viewModel
);
return this.Direct();
and the view is<html>
<head>
<meta name="viewport" content="width=device-width" />
<title></title>
</head>
<body>
<div>
@( X.Window().ID("Edit")
.Title(Model.NAME)
.Icon(Icon.ApplicationViewDetail)
.Width(800)
.Height(550)
.Layout(LayoutType.Fit)
.Border(true)
Can I make this render parent, render in parent or whatever the syntax is...?
.DirectEvents(de =>
{
de.ItemDblClick.Url = "List/DblClick";
de.ItemDblClick.CleanRequest = true;
de.ItemDblClick.EventMask.ShowMask = true;
de.ItemDblClick.Method = HttpMethod.GET;
de.ItemDblClick.ExtraParams.Add(new Parameter("id", "record.get('REF')", ParameterMode.Raw));
})
@{
var X = Html.X();
}
<!DOCTYPE html>
<html>
<head>
<title>Ext.Net.MVC v2 Example</title>
<script>
var openWindow = function(recordId) {
App.Window1.removeAll();
App.Window1.show();
App.Window1.load({
params: {
recordId: recordId
}
});
};
</script>
</head>
<body>
@X.ResourceManager()
@(X.Window()
.ID("Window1")
.Title("Window")
.Hidden(true)
.Height(100)
.Loader(X.ComponentLoader()
.AutoLoad(false)
.Mode(LoadMode.Html)
.Scripts(true)
.Url(Url.Action("WindowContent"))
.Params(new
{
containerId = "Window1"
})
)
)
@(X.Panel()
.Loader(X.ComponentLoader()
.Mode(LoadMode.Frame)
.Url(Url.Action("Child"))
)
)
</body>
</html>
Child.cshtml@{
var X = Html.X();
}
<!DOCTYPE html>
<html>
<head>
<title>Ext.Net.MVC v2 Example</title>
</head>
<body>
@X.ResourceManager()
@(X.GridPanel()
.Store(X.Store()
.Model(X.Model()
.Fields("id", "text")
)
.DataSource(new object[]
{
new
{
id = 1,
text = "Some Text 1"
},
new
{
id = 2,
text = "Some Text 2"
}
})
)
.ColumnModel(
X.Column().Text("id").DataIndex("id"),
X.Column().Text("text").DataIndex("text")
)
.Listeners(events =>
events.ItemDblClick.Handler = "parent.openWindow(record.getId());"
)
)
</body>
</html>
WindowContent.cshtml@model string
@(Html.X().Label()
.Text("The Window has been opened for the record with id - " + Model)
)
Controllerpublic ActionResult Index()
{
return View();
}
public ActionResult Child()
{
return View();
}
public ActionResult WindowContent(string containerId, string recordId)
{
return new PartialViewResult
{
ContainerId = containerId,
RenderMode = RenderMode.AddTo,
Model = recordId
};
}
var openWindow = function(recordId)
as to have a generic window for opening all the record edit windows for any grid in the application?.Url(Url.Action("WindowContent"))
to the openWinow javascript function with controller action path passed in as parameters?