How to refresh the Kendo UI grid

后端 未结 1 1429
半阙折子戏
半阙折子戏 2021-02-13 01:23

I am trying to refresh a Kendo UI grid but have not yet been successful. Would anybody please advise what I missed or what I did wrong?

I have the following code:

1条回答
  •  清酒与你
    2021-02-13 01:55

    your script should be

    $('#btnRefresh').click(function (e){
            var grid = $("#Product").data("kendoGrid");
                   grid.dataSource.page(1);
                   grid.dataSource.read();
          });
    

    in your controller add references to

    • using Kendo.Mvc.UI;
    • using Kendo.Mvc.Extensions;

    your ActionResult should be

    public ActionResult RefreshAll([DataSourceRequest] DataSourceRequest request)
            {
                //assuming db.ProcessAll() will return a list object
                return Json(db.ProcessAll().ToDataSourceResult(request));
            }
    

    0 讨论(0)
提交回复
热议问题