Background information
The Ajax Type-Ahead builder provides some very useful functionality to enhance the user interface of a portlet. The builder, however, may not perform well if the type ahead lookup is being done against a very large data set.
Sample description
The sample provided here illustrates how to use the Ajax Type-Ahead builder in conjunction with a data service (such as a SQL Call builder) to obtain a limited set of type ahead suggestions.
The Ajax Type-Ahead builder is configured to use no Lookup Table. It will obtain its values from the Values input. The Values input has been configured using a method call to a custom doLookup method that has been created. The doLookup method first checks to see that the user has entered at least 3 characters before attempting to find any suggestions. If the user has entered at least 3 characters, it calls the SQL Call builder in the model. The SQL Call builder is passed the current user data from the input field as obtained from the Linked Java Object that the Ajax Type-Ahead builder creates. The Filter mode of the Ajax Type-Ahead builder is set to Show all values, as the filtering is being done by the database.
Notes on running the sample and prerequisites
Import the attached zip file into your project using the Import WebSphere Portlet Factory Archive command.
You will need to customize the sample and replace the references in the SQL Call builder with your own. The SQL DataSource and SQL Statement inputs need to be changed to suit your database configuration.
Download
Download the sample model from here: ajax_type_ahead_sample.zip