在按钮单击事件(网格中的自定义命令)上,我想将数据发送到剑道窗口(loadcontentfrom)操作,并想知道是否有人可以指导吗?
<div class="container-fluid">
<div class="row">
<div class="col-md-4">
@Html.Label("Summary")
@(Html.Kendo().Grid<Settings.Services.Models.DocumentTypeStatusList>()
.Name("EmpGrid")
.Columns(columns =>
{
columns.Bound(c => c.DocumentType.DocumentTypeDescription).Width(200);
columns.Bound(c => c.Status).Width(100);
columns.Command(c => c.Custom("ADD").IconClass("k-icon k-i-plus").Click("showDetails")).Width(100);
})
.HtmlAttributes(new { style = "height: 700px;" })
.Scrollable()
.Sortable()
.Pageable(pageable => pageable
.Refresh(true)
.PageSizes(true)
.ButtonCount(5))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.DocumentType.DocumentTypeId);
})
.Read(read => read.Action("GetAllDocumentsTypeStatus", "Home"))
.PageSize(20)
)
)
@(Html.Kendo().Window().Name("Details")
.Title("Add/Edit Document Type Setting")
.Visible(false)
.Modal(true)
.Draggable(true)
.Width(600)
.LoadContentFrom("ModifyDocumentTypeSettings", "Home")
.Actions(actions => actions.Close())
)
</div>
</div>
这是从网格获取值的javascript函数,但是我如何将其传递给kendo窗口函数:
function showDetails(e) {
e.preventDefault();
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
var wnd = $("#Details").data("kendoWindow");
wnd.content(detailsTemplate(dataItem));
wnd.center().open();
}
这可以通过如下重构代码来解决(有关更多信息,请参见此问题:how to set LoadContentFrom kendo window in run time):
var dataItem = this.dataItem($(e.currentTarget).closest("tr"));
$(document.body).append('<div id="Window"></div>');
$('#Window').kendoWindow({
title: "Add/Edit Document Type Setting",
modal: true,
resizable: false,
width: 400,
content: "/Home/ModifyDocumentTypeSettings/" + dataItem.id,
visible: false,
minHeight: 350,
animation: {
open: {
effects: "expandVertical",
duration: 1000
},
},
close: function () {
setTimeout(function () {
$('#Window').kendoWindow('destroy');
}, 200);
}
}).html('<img src="761.gif" />').data('kendoWindow').center().open();
这可以通过如下重构代码来解决(有关更多信息,请参见此问题:how to set LoadContentFrom kendo window in run time):