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

AJAX results should not be filtered? #32

Open
carlosescri opened this issue Dec 10, 2012 · 1 comment
Open

AJAX results should not be filtered? #32

carlosescri opened this issue Dec 10, 2012 · 1 comment

Comments

@carlosescri
Copy link

I don't know if this is correct but, when I configure an AJAX call to give results to Typeahead it is supposed that results are filtered. As typeahead searchs for the querystring in the results If one of them hasn't it then it is not displayed.

query: 'asdf' # My database object has a field with that value
result: {id: 3, name: 'John Smith'} # Not displayed because 'asdf' is not contained in 'John Smith'

I know this is issue occurs because I'm using typeahead as a classic autocomplete, but I'm sure that other users are going to use it in the same way. I've fixed this in my results appending the field where the string was found, but it would be nice if we have an option for disabling filtering when using AJAX.

Cheers,

C.

@brunowego
Copy link
Contributor

Try it...

        // Call the typeahead.
        $('#searchname').typeahead({
            ajax: {
                url: 'index.php?option=com_bolsas&task=pessoas.getname&tmpl=component&format=json',
                timeout: 300,
                method: 'get',
                triggerLength: 3,
                displayField: 'name',
                preDispatch: function (query) {
                    return {
                        nome: query
                    };
                }
            },
            display: 'name',
            val: 'id'
        });

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