minLength在jquery中自动完成多个值插件

min*_*nil 3 jquery jquery-autocomplete

我正在使用jquery autocomplete pluguin.配置为使用多个值.

我设置选项 minLength:2

minLength选项仅适用于第一个autosuggest单词,对于多个值,它不起作用.

我如何配置或我需要覆盖哪个方法来解决此问题.

http://jqueryui.com/demos/autocomplete/#multiple

Chr*_*rga 7

jQuery UI网站上的多个远程演示演示了这种行为.您只需添加自定义搜索功能:

$('#autocomplete').autocomplete({
    search: function() {
        // custom minLength
        var term = extractLast( this.value );
        if ( term.length < 2 ) {
            return false;
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

请参阅:http://jqueryui.com/demos/autocomplete/#multiple-remote