The AutoComplete widget provides a flexible and accessible way to offer suggestions or some kind of filtering information as a user type text information in an input field . If you have used Google , you might see that Google starts providing autocomplete suggestion with entries depending on user’s current input .
Lift provides a very easy way to implement Autocomplete using Scala .
Here , I am going to explain two ways to implement Autocomplete Functionality in Lift using Scala .
1) Using this way , you can use Lift’s Autocomplete widget but with limited features .
Here is how we integrate it into your Lift application.
Add below line in Boot.Scala
b) Snippet Binding
In order to implement in Snippet , follow below lines :-
2) If you have used Facebook , you might agree that at many places , Facebook provides filtered information in a very nice way . Using above way , you could not implement like this .
For this you have to extend Autocomplete.Scala and modify it . In one of my project , I implemented Auto complete widget in facebook style by modifying Autocomplete.Scala .
In the Snippet :
In the above code , getResults is returning sequence of 5 strings . I have modified Autocomplete.Scala as per requirement . You can modified this file , if you want to make your Autocomplete widget to be more attractive .
Lift’s Auto complete Widget is basically a JQuery’s AutoComplete widget . You can use Jquery’s Autocomplete property in Autocomplete.Scala .