Giter VIP home page Giter VIP logo

Comments (8)

tkirda avatar tkirda commented on May 18, 2024

You can provide your own function that determines what should be included. See lookupFilter function in the source and documentation. In your case it should be:

lookupFilter: function (suggestion, originalQuery, queryLowerCase) {
    return suggestion.value.toLowerCase().indexOf(queryLowerCase) === 0;
}

from jquery-autocomplete.

quatzael avatar quatzael commented on May 18, 2024

Thanks, that is exactly what I meant.

from jquery-autocomplete.

quatzael avatar quatzael commented on May 18, 2024

Hi, I'm here again!
Is it also possible for the hints to have only the starting letters highlighted?
Example:
I am starting to type ROVER and when I type the first letter R, both the first and the last R is highlighted so it is like:
R O V E R. But I need only the first letter to be highlighted so it would be like: R O V E R.
Thanks.

from jquery-autocomplete.

tkirda avatar tkirda commented on May 18, 2024

Hi, you will need to provide your own formatResult function. I slightly modified the default, this should do the job:

formatResult: function (suggestion, currentValue) {
    var reEscape = new RegExp('(\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\'].join('|\\') + ')', 'g'),
        pattern = '^(' + currentValue.replace(reEscape, '\\$1') + ')';

    return suggestion.value.replace(new RegExp(pattern, 'gi'), '<strong>$1<\/strong>');
}

from jquery-autocomplete.

albanR avatar albanR commented on May 18, 2024

thanks @tkirda for the time you spent on answering that question, exactly what I needed.

from jquery-autocomplete.

zaibkhan avatar zaibkhan commented on May 18, 2024

Hi,

How i can sort the result. I like to sort my suggestions that exact match letter come first and rest of the result after that. for example

when i type app the first result should show app, apple, application and and rest like other matching like web application etc.

Please help

from jquery-autocomplete.

tkirda avatar tkirda commented on May 18, 2024

If results are coming from the server, then sorting is server responsibility. If client side, then you will need to alter the source in the getSuggestionsLocal function and sort data before returning.

from jquery-autocomplete.

zaibkhan avatar zaibkhan commented on May 18, 2024

thanks i fixed :)

from jquery-autocomplete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.