Support Article
AutoComplete triggers a search on a single keystroke
SA-79999
Summary
The requirement is to add a delay to the out-of-the-box AutoComplete control before the search initiates a server request to populate it. This requirement is such that the user can complete typing in the field before the list is populated. After four characters are typed, the search triggers a REST Request to populate the control. Performance degrades since every keystroke after four characters triggers a request.
Error Messages
Not Applicable
Steps to Reproduce
- Configure an AutoComplete field with the Minimum character search set to 4.
- Enter four characters in the field.
Root Cause
AutoComplete control initiated the REST API to obtain the search results after the minimum number of characters are typed. The default delay to trigger this call is 250ms and is not configurable.
Resolution
- Apply HFix-53425.
- Add the below lines of code to the UserWorkForm:
<script>
pega.u.d.autocompleteDelay=x;
</script>
Here x represents the number of milliseconds before load request is initiated.
For example,
For a delay of one second, x=1000.
For a delay of two seconds, x=2000, and so on.
Published January 6, 2020 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.