jquery-typeahead icon indicating copy to clipboard operation
jquery-typeahead copied to clipboard

Option to disable correlative match

Open donruperto opened this issue 11 years ago • 3 comments

Hi,

I´m using a remote source and the server can also return synonyms to the entered text. You are comparing the result with the query and in my case it occurs the some results won´t contain the query so I never get them displayed.

For me I temporarily added an option "skipQueryComparison" that allows me to skip that check.

Snippet from the function "searchResult"

if (this.options.skipResultComparison === false) {
    if (match < 0 && !correlativeMatch) continue;
}
//if (match < 0 && !correlativeMatch) continue;
if (this.options.offset && match !== 0) continue;
if (this.options.source[group].ignore && this.options.source[group].ignore.test(comparedDisplay)) continue;

Do you plan to integrate such an option an a future release or have I overlooked an existing way to accomplish this?

Thx Rupert

donruperto avatar Nov 11 '15 14:11 donruperto

Hey Rupert,

you can check the source option in the documentation: filter: if set to false, no filtering will occur. Useful for options.dynamic datasets that comes already filtered from the backend

...
source: {
        game: {
            filter: false, // Here
            url: [{
                url: "http://www.gamer-hub.com/game/list.json",
                dataType: "jsonp"
            }, "data"]
        }
}

running-coder avatar Nov 11 '15 19:11 running-coder

Hi Tom,

thank you, works like a charm :+1:

Rupert

donruperto avatar Nov 12 '15 07:11 donruperto

welcome

running-coder avatar Nov 12 '15 16:11 running-coder