开发者

Jquery Autocomplete, multiple separator array

开发者 https://www.devze.com 2023-02-05 18:34 出处:网络
$(\"#tags\").autocomplete([\"c++\", \"java\", \"php\", \"coldfusion\", \"javascript\", \"asp\"], { width: 320,
$("#tags").autocomplete(["c++", "java", "php", "coldfusion", "javascript", "asp"], {
width: 320,
max: 4,
highlight: false,
multiple: true,
multipleSeparator: " ",
scroll: true,
scrollHeight: 300
});
)};

I am trying to use Jquery UI autocomplete with multipleSeparator. Which means that I can pass a string array as { " AND ", " OR " } and when someone will type like:

C++ and Java and p

the php will come.

So basically I am trying to make a logical operator based expression.

Looking for Candidate: C# or开发者_开发百科 C++ and ASP

I need intelli sense in C# as well as in C++ but not in or , and.

Please help how can I amend?


I managed to get that through:

 $.ajax({
     url: sourceUrl,
     dataType: "json",
     type: "POST",
     cache: true,
     data: {
          text: fnGetTerm(request, autoCompleteSeparator) 
     },

where fnGetTerm is written as:

function fnGetTerm(request, autoCompleteSeparator) {
    var startsWith = null;
    if (autoCompleteSeparator == undefined || autoCompleteSeparator == null || autoCompleteSeparator.length == 0) {
        startsWith = request.term
    }
    else {
        startsWith = fnAutoCompleteExtractLast(request.term, autoCompleteSeparator);
    }

    return $.trim(startsWith);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消