我在我的MVC視圖上爲kendo ui網格創建上下文菜單。上下文菜單將包含添加,編輯,刪除li項目。點擊添加選項將打開mvc剃刀視圖爲模態。編輯和刪除的情況也是如此。我知道劍道提供kendo.window作爲模態打開。我如何從上下文菜單中調用它。我是否需要在局部視圖中創建模態窗口或kendo.Window。有人可以分享一個相關的例子,以便我找到一些方向。我看到的最接近的例子是使用Kendo MVC控件。我正在尋找使用kendoui jquery的例子。單擊上下文菜單中的選項需要打開kendo UI模式窗口
查看
@Html.Partial("~/Views/Admin/_AdminMenu.cshtml");
<div id="grid" class="grids"></div>
<div id="accessDiv" style=" width 100%; height 100%; background-color #fff;">
<label>Enter access key</label>
<input type="text" />
<input type="button" title="Enter" value="Enter" />
</div>
<ul id="contextMenu">
<li>Add</li>
<li class="k-separator"></li>
<li>Edit</li>
<li class="k-separator"></li>
<li>Delete</li>
</ul>
@section scripts{
<script>
$(document).ready(function() {
var requests = [
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ranjit Ravindranath Menon", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ranjit Ravindranath Menon", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" },
{ requestId: "337", activity: "Set Up Billing", team: "Charge Maint", priority: "x", customer: "Audi", custId: "25897895", primeBL: "WP", salesOffice: "3100", createdDate: "14/02/2017", requiredBy: "18/02/2017", createdBy: "Ralf Klein", withName: "Ingri Schmidt", status: "Complete" }
];
var requestDataSource = new kendo.data.DataSource({ data: requests, pageSize: 20, sort: { field: "requestId", dir: "asc" } });
requestDataSource.read();
$("#grid").kendoGrid({
dataSource: requestDataSource,
columns: [
{ field: "requestId", title: "Request", width:"110px" },
{ field: "activity", title: "Activity", width: "110px" },
{ field: "team", title: "Team", width: "110px" },
{ field: "priority", title: "Priority", width: "110px" },
{ field: "customer", title: "Customer", width: "130px" },
{ field: "custId", title: "Cust ID", width: "120px" },
{ field: "primeBL", title: "Prim BL", width: "120px" },
{ field: "salesOffice", title: "Sales Office", width: "140px" },
{ field: "createdDate",title: "Created", width: "120px" },
{ field: "requiredBy", title: "Required By", width: "140px" },
{ field: "createdBy", title: "Created By", width: "140px" },
{ field: "withName", title: "With", width: "110px" },
{ field: "status", title: "Status", width: "100px" }
//{ command: ["edit", "destroy"], width: "250px" }
],
scrollabe:false,
pageable: true,
sortable:true,
//groupable: true,
filterable: true,
editable: "inline",
reorderable: true
});
$("#contextMenu").kendoContextMenu({
target: "#grid",
alignToAnchor: false
});
var accessWindow = $("#accessDiv").kendoWindow({
actions: {}, /*from Vlad's answer*/
draggable: true,
height: "300px",
modal: true,
resizable: false,
title: "Access",
width: "500px",
visible: false /*don't show it yet*/
}).data("kendoWindow").center().open();
accessWindow.data("kendoWindow").center();
accessWindow.data("kendoWindow").open();
});
</script>
}
而你張貼問題,請添加一些你想代碼。這對社區瞭解您的問題將會非常有幫助。 –
我已更新帖子,代碼爲 – Tom
當前窗口在窗體加載時打開。我只需要在用戶從上下文菜單中選擇添加或編輯選項時才能打開 – Tom