Kendo Ui Grid not rebinding after search button click

前端 未结 1 1653
情歌与酒
情歌与酒 2021-01-15 16:16

I having difficulty where the Kendo Ui grid would not rebind with new result after the Search button click.Please let me know how i could achieve this. Thank you

Cur

相关标签:
1条回答
  • 2021-01-15 16:33

    Try like this,

    In your grid read method in view like this

      .Read(read => read.Action("GetData", "Details").Data("GetData"))
    

    You button should be Submit Type

      <input type="Submit" id="btnSearch" style="height:32px; font-size:14px; background-color:#3399FF" class="k-button" title="Search" value="Search" />
    

    Script

     function GetData() {
        return {
    HRN: $('#HRN').val(),
    FamilyName: $('#FamilyName').val(),
    GivenName: $('#GivenName').val(),
    Priority: $('#Priority').val()
    
        };
    }
    
    
    
    $(document).ready(function () {
      $("#btnSearch").click(function (e) {
                $("#Result").data("kendoGrid").dataSource.read();
                $("#Result").data("kendoGrid").refresh();
                e.preventDefault();
            });
    });
    

    Controller

    public ActionResult GetData([DataSourceRequest] DataSourceRequest request,  string HRN, string FamilyName, string GivenName, string Priority)
            {
                DataTable result = GetList(HRN,FamilyName,GivenName,Priority);
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                return Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
            }
    
    0 讨论(0)
提交回复
热议问题