如何基于其他参数刷新剑道网格 [英] How to refresh kendo grid base on additional paramer

查看:107
本文介绍了如何基于其他参数刷新剑道网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个针对剑道网格的自定义读取功能....

I have a customize Read function for kendo grid ....

 public virtual async Task<ActionResult> Read([DataSourceRequest] DataSourceRequest request,
        RecordStatus? recoredStatus){ // code here }

现在我想通过使用剑道剑道中的记录状态来刷新网格

now I want refresh my grid by using record status in kendo with jquery

<script type="text/javascript">
function viewButtonClickHandler(e) {
        alert(e.Id)
        $('#Grid').data('kendoGrid').dataSource.read(e.Id);
        $('#Grid').data('kendoGrid').refresh();

}

但是我如何在读取函数中发送此附加参数(recordStatus)!我可以这样做吗?

but how I send this additional parameter ( recordStatus )in read function !? can I do this !?

推荐答案

因此,如果您使用的是Kendo MVC UI,则可以将Data属性用于DataSource的Read方法.因此,当您请求读取操作时,将通过使用-

So if you are using Kendo MVC UI you can use the Data property for the Read method of DataSource . So the client side method DataHandlerName will execute while you are requesting for the read action, by using-

    $('#Grid').data('kendoGrid').dataSource.read();

您可以轻松处理客户端脚本. Kendo GRID将遵循您的服务器端代码,

You can easily handle the client side script. Your Server Side code will be following for Kendo GRID,

    .DataSource(dataSource => dataSource.Ajax().ServerOperation(false).Read(r=> r.Action("ActionName","ControllerName").Type(HttpVerbs.Post).Data("DataHandlerName")))

您的客户端代码将是-

    <script> 
       function DataHandlerName() {
         //your code will goes here 

          var request={
                  id:1
                };
             return request ;
       }
   </script>

您的行动方法将成为

public ActionResult ActionName([DataSourceRequest] DataSourceRequest request,int id){}

这篇关于如何基于其他参数刷新剑道网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆