kendo-ui - 剑道用户界面 : How to avoid server call when text entered in combobox is less than min length

标签 kendo-ui kendo-grid kendo-asp.net-mvc kendo-combobox

我正在使用 Kendo UI ComboBox“version:2016:1.112.545”并使用“ http://demos.telerik.com/kendo-ui/combobox/serverfiltering ”作为引用。我将组合框的最小长度设置为三个字符(搜索字符串)。因此,当我输入三个字符时,应该完成对 Web 服务器的请求,并且它按预期工作。现在的问题是,当我清除 ComboBox 中的全部内容时,再次完成对 Web 服务器的请求(使用空搜索字符串)。如何避免这个调用?

(注意:这个问题可以在上面的 telerik demos URL 中重现。使用浏览器的开发者工具来监控服务器调用。)

最佳答案

嘿尝试使用下面给定的代码:-

filtering: function(e) {
      var filter = e.filter;

      if (!filter.value) {
        //prevent filtering if the filter does not value
        e.preventDefault();
      }
  }

请参阅 jsfildde 中的内容:- http://jsfiddle.net/MG89G/1936/

关于kendo-ui - 剑道用户界面 : How to avoid server call when text entered in combobox is less than min length,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35952286/

相关文章:

json - 来自 JSON 的 WebAPI 模型绑定(bind)

c# - 如何在 ASP.NET Core MVC 应用程序 Web API Controller 中防止 CSRF/XSRF

javascript - Kendo/IE/缓存

jquery - Kendo 自动完成如何禁用默认的 css 样式

jquery - 遍历所有数据项(所有 kendo ui Treeview 节点)

javascript - 首先加载剑道 UI 网格

javascript - 如何更改 Kendo Grid 工具栏 "Download to Excel"按钮的颜色?

jquery - 剑道网格中基于条件的列的值

javascript - Kendo网格不响应数据源过滤

javascript - JSON 没有通过 JQuery 传递给 Controller