Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not able to perform empty search, even with min-length => 0 #81

Open
mvaragnat opened this issue Mar 22, 2017 · 1 comment
Open

Not able to perform empty search, even with min-length => 0 #81

mvaragnat opened this issue Mar 22, 2017 · 1 comment

Comments

@mvaragnat
Copy link

mvaragnat commented Mar 22, 2017

First of all thank you for this gem, the simple_form integration makes life really easy.

I have configured my field with 'min-length' => 0
In addition to the normal search at the first key press, I would like to perform an "empty" search when the element get focus.

autocomplete_field.on('focus', function(){
    console.log('focus')
    autocomplete_field.autocomplete( 'search', '' )
})

However the search is not performed (the GET route is not hit). Is there an option I have overlooked?

(actually, I realize I can do autocomplete_field.autocomplete( 'search', 'A' ), it gives the same result for sufficiently large lists...)

@rafaeelaudibert
Copy link

@mvaragnat I can't make the same. How are you selecting this autocomplete_field? My field doesn't have this function to call.

I am selecting it with $('#my_field').on('focus', e => e.target.autocomplete('search', ' '), but it says '#my_field' doesn't have this function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants