在IE10中删除后,Kendo ui网格不刷新

时间:2013-10-03 06:33:46

标签: kendo-ui

@(Html.Kendo().Grid<TRC.Models.ProductModel>()
    .Name("Product")
    .HtmlAttributes(new { @Style = "align:center; font-size:12px; width:470px; height:100%" })
    .Columns(columns =>
    {


        columns.Bound(p => p.ProductId).Width(220);
        columns.Bound(p => p.ProductName).Width(220);
        columns.Bound(p => p.ProductCreateDate).EditorTemplateName("Date").Format("{0:dd/MM/yyyy}").Width(120);
        //columns.Command(commands => commands.Edit()).Width(100);
        columns.Command(commands => commands.Destroy());
    })
    .Editable(editable => editable.Mode(GridEditMode.InLine))
    .Sortable()
    .Selectable()
    .Scrollable(scrollable => scrollable.Virtual(true))
    .ColumnMenu(c => c.Columns(false))
    .DataSource(dataSource => dataSource
        .Ajax()//bind with Ajax instead server bind
        .ServerOperation(true)
            .Model(model =>
            {
                model.Id(p => p.ProductId);
                model.Field(p => p.ProductCreateDate).DefaultValue(DateTime.Now);
                model.Field(p => p.ProductCreateDate).Editable(false);

            })
            .Sort(sort => sort
            .Add(x => x.ProductCreateDate).Descending()
        )
        .Read(read => read.Action("GetProduct", "ProductDetails").Type(HttpVerbs.Get))
        .Destroy("DeleteProduct", "ProductDetails")
    )
)

控制器:

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult DeleteProduct([DataSourceRequest] DataSourceRequest request, ProductModel model)
{
    if (model != null)
    {
        TRC_DataAccessLayer.SessionsList sList = db.GetProductbyId(model.ProductId);
        dbProduct.DeleteProduct(model.ProductId);
    }

    return View(GetProductData(request));
}

1 个答案:

答案 0 :(得分:0)

试试这个 - &gt;

替换标记中的以下行

.Destroy("DeleteProduct", "ProductDetails")

.Destroy(update => update.Action("DeleteProduct", "ProductDetails"))

在您的控制器中,替换

return View(GetProductData(request));

return Json(new[] { model}.ToDataSourceResult(request));