Dojo   发布时间:2022-04-21  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了dojo – dijit过滤选择最小长度大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我似乎无法找到一种方法来要求过滤选择输入具有一定的长度.我试过这样的:

new dijit.form.FilteringSELEct({
    'name': 'bla','store': jsonRestStore,'searchAttr': "name",'pattern': '.{3,}','regExp': '.{3,}'
});

但它并没有改变一件事.我希望过滤选择仅查询商店,如果已输入至少3个字符.不能那种异国情调的要求,可以吗?该商店后面有数以千计的商品,所以只用1或2个字符查询就很慢了.

解决方法

做了一些搜索,在dojo邮件列表上找到了 this post.总而言之,FilteringSELEct无法为其提供本机支持,但它实现起来非常简单.

// custom min input character count to trigger search
minKeyCount: 3,// override search method,count the input length
_startSearch: function (/*String*/key) {
    if (!key || key.length < this.minKeyCount) {
    this.closeDropDown();
    return;
    }
    this.inherited(arguments);
}

同样在API Docs中,有一个searchDelay属性,可以帮助您最大限度地减少查询次数.

searchDelay 
Delay in milliseconds between when user types something and we start searching based on that value

大佬总结

以上是大佬教程为你收集整理的dojo – dijit过滤选择最小长度全部内容,希望文章能够帮你解决dojo – dijit过滤选择最小长度所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。