【问题标题】:Kendo UI: How to avoid server call when text entered in combobox is less than min lengthKendo UI:当组合框中输入的文本小于最小长度时如何避免服务器调用
【发布时间】:2016-03-12 00:35:36
【问题描述】:

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

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

【问题讨论】:

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


    【解决方案1】:

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

    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/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-04
      • 1970-01-01
      • 2014-12-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-02
      相关资源
      最近更新 更多