简体   繁体   English

Telerik MVC网格在网格为空时丢失GridOperationMode.Client

[英]Telerik MVC grid losing GridOperationMode.Client when grid is empty

Is there a way to force the Telerik MVC grid to use GridOperationMode "client" even if the grid contains zero rows? 有没有一种方法可以强制Telerik MVC网格使用GridOperationMode“客户端”,即使该网格包含零行也是如此? I have observed that the grid respects the operation mode if there are one or more rows present, but it seems to fall back to server mode if the result set is empty. 我观察到,如果存在一行或多行,则网格会尊重操作模式,但是如果结果集为空,则网格似乎会退回到服务器模式。 Clicking the column hearders casues a post request to the server... It seem to do a single post when rendering the empty grid initially as well. 单击听众列会向服务器发出发布请求...最初渲染空网格时,似乎也会执行单个发布。 I debugged the Telerik JavaScript, and it is in fact sending an Ajax post request when rendering an empty grid. 我调试了Telerik JavaScript,实际上是在渲染空白网格时发送Ajax发布请求。 Is there a way to disable this request? 有没有办法禁用此请求?

Is there an explenation for this behavior? 这种行为是否有帮助?

The grid makes an Ajax request by default when empty. 网格默认为空时会发出Ajax请求。 It tries to load the data from the action method it is configured to. 它尝试从配置的操作方法中加载数据。 To prevent that use the OnDataBinding event: 为了避免这种情况,请使用OnDataBinding事件:

  function onDataBinding(e) {
      e.preventDefault();
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM