我正在使用Kendo UI Web for asp.net mvc。我通過一個網格命令按鈕生成一個彈出窗口。在彈出窗口關閉後,我想要刷新網格。彈出窗口關閉後刷新Kendo Grid
在彈出的窗口關閉事件:
網格此時不確定的。
劍道窗口定義:
@(Html.Kendo().Window()
.Name("Rates")
.Title("Rates")
.Visible(false)
.Modal(true)
.Draggable(true)
.Width(850)
.Height(1200)
.Events(x => x.Close("ClosingRateWindow"))
)
JavaScript打開的窗口(局部視圖返回):
wnd.refresh({
url: BASE_APP_URL + "ContractRateAdmin/OpenContractRate/",
data: { data: data },
traditional: true
});
wnd.center();
wnd.open();
電網定義:
@(Html.Kendo().Grid<TMS.MVC.TIMS.Models.Admin.Contract.ContractOrderEventGridModel>()
.Name("ContractDetailOrderEventGrid")
.Columns(columns =>
{
columns.Command(o =>
{
o.Destroy();
o.Edit();
}).Width(100).Title("Commands");
columns.Command(command =>
{
command.Custom("Rates").Click("ShowRates");
}).Title("Rates").Width(120);
columns.Bound(o => o.ContractId).Hidden(true);
columns.Bound(o => o.OrderTypeId).Hidden(true);
//columns.Bound(o => o.ActiveRateMissing).Width(70).Title("Missing Rates?");
columns.Bound(o => o.OrderLevelFlag).Width(50).Title("Order Level").EditorTemplateName("ContractOE_OrderLevelFlag");
columns.Bound(o => o.Active).Width(80).Title("Active").EditorTemplateName("ContractOE_Active");
columns.Bound(o => o.InvoiceDescription).Width(150).Title("Invoice Desc");
columns.Bound(o => o.SourceContainerOwnerNameDisplay).Width(150).Title("Src Cont Owner").EditorTemplateName("ContractOE_SourceContainerOwner");
columns.Bound(o => o.DestContainerOwnerNameDisplay).Width(150).Title("Dest Cont Owner").EditorTemplateName("ContractOE_DestContainerOwner");
columns.Bound(o => o.SourceContainerTypeName).Width(150).Title("Src Cont Type").EditorTemplateName("ContractOE_SourceContainerTypeName");
columns.Bound(o => o.DestContainerTypeName).Width(150).Title("Dest Cont Type").EditorTemplateName("ContractOE_DestContainerTypeName");
columns.Bound(o => o.SourceContainerName).Width(150).Title("Src Container").EditorTemplateName("ContractOE_SourceContainerName");
columns.Bound(o => o.DestContainerName).Width(150).Title("Dest Container").EditorTemplateName("ContractOE_DestContainerName");
columns.Bound(o => o.EventAliasName).Width(150).Title("Event").EditorTemplateName("ContractOE_EventAliasName");
columns.Bound(o => o.ProductName).Width(150).Title("Product").EditorTemplateName("ContractOE_ProductName");
columns.Bound(o => o.OrderByNameDisplay).Width(150).Title("Order By").EditorTemplateName("ContractOE_OrderBy");
columns.Bound(o => o.OrderTypeName).Width(150).Title("Order Type").EditorTemplateName("ContractOE_OrderTypeName");
columns.Bound(o => o.EmployeeDisplay).Width(150).Title("Employee").EditorTemplateName("ContractOE_EmployeeDisplay");
columns.Bound(o => o.CarrierName).Width(150).Title("Carrier").EditorTemplateName("ContractOE_CarrierName");
})
.Events(e => e
.Save("Contract_Save")
//.Remove("ContractOrderEventGrid_Remove")
.DataBound("Contract_DataBound"))
.Scrollable(scrolling => scrolling.Enabled(true).Height("300px"))
.ToolBar(toolbar => {
if (Model.DetailModel.ContractAdminDetailPermissionModel.AddOrderEvent_Button_Visible == true)
toolbar.Create().Text("Add");
})
.HtmlAttributes(new { style = "width: 1200px" })
.Editable(editable => editable.Mode(GridEditMode.InLine))
.Sortable(sorting => sorting.Enabled(true))
.Pageable(paging => paging.Enabled(false))
.Resizable(resizing => resizing.Columns(true))
.Filterable(filtering => filtering.Enabled(true))
.Groupable(grouping => grouping.Enabled(true))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model =>
{
model.Id(p => p.ContractOrderEventId);
model.Field(x => x.ActiveRateMissing).Editable(false);
model.Field(x => x.ContractId).Editable(false);
model.Field(x => x.OrderTypeId).Editable(false);
model.Field(x => x.Active).Editable(true).DefaultValue("Y");
model.Field(x => x.OrderLevelFlag).Editable(true).DefaultValue("N");
model.Field(x => x.InvoiceDescription).Editable(true).DefaultValue("Enter Invoice Description");
model.Field(x => x.SourceContainerOwnerNameDisplay).Editable(true).DefaultValue("ALL");
model.Field(x => x.DestContainerOwnerNameDisplay).Editable(true).DefaultValue("ALL");
model.Field(x => x.SourceContainerTypeName).Editable(true).DefaultValue("ALL");
model.Field(x => x.DestContainerTypeName).Editable(true).DefaultValue("ALL");
model.Field(x => x.SourceContainerName).Editable(true).DefaultValue("ALL");
model.Field(x => x.DestContainerName).Editable(true).DefaultValue("ALL");
model.Field(x => x.EventAliasName).Editable(true).DefaultValue("ALL");
model.Field(x => x.ProductName).Editable(true).DefaultValue("ALL");
model.Field(x => x.OrderByNameDisplay).Editable(true).DefaultValue("ALL");
model.Field(x => x.OrderTypeName).Editable(true).DefaultValue("ALL");
model.Field(x => x.EmployeeDisplay).Editable(true).DefaultValue("ALL");
model.Field(x => x.CarrierName).Editable(true).DefaultValue("ALL");
})
.Events(x =>
{
// x.RequestEnd("RefreshContractDetailOrderEventGrid");
//x.Error("ContractDetailOrderEventGrid_Error");
})
.Create(update => update.Action("CreateContractOrderEvent", "ContractGrid", new { selectedContractId = Model.DetailModel.ContractId }))
.Read(read => read.Action("ReadContractOrderEvent", "ContractGrid", new { contractId = Model.DetailModel.ContractId }))
.Update(update => update.Action("UpdateContractOrderEvent", "ContractGrid", new { contractId = Model.DetailModel.ContractId }))
.Destroy(update => update.Action("DestroyContractOrderEvent", "ContractGrid"))
))
如何做任何想法這個?
可變網格未定義。 – Elim99
你可以發佈你的網格定義。 – NunoCarmo
我已將網格定義添加到原始帖子。 – Elim99