ESDictor
ESDictor

Reputation: 745

JQueryUI AutoComplete Filtering

I have a JQueryUI AutoComplete in my application that allows a User to search for other users in the system. This is actually handled by a JavaScript array loaded in the client during form load. However, I am being told now that, by default, users should only search for other users in the same site they are in. Then, optionally, they can expand that search for users company-wide.

I have come up with a few ways to handle this .. all of which are pretty kludgy. Is there a "right way" to do this before I go down that road?

Upvotes: 0

Views: 58

Answers (1)

Johny
Johny

Reputation: 387

Well, You can filter your data using request object & response event in source option. Its up to you how you want to customize but this will get you started..

jQuery Autocomplete API < Look up response & request usage.

$('#controlID').autocomplete({
    source: function(request, response){
        // add your data manipulation logic here...
    }
});

Also, you can access the current user input using 'request.term'

Upvotes: 1

Related Questions