Results manipulation
From time to time you need to change retrieved results before presenting them to a user - removing certain options, adding additional options or other types of manipulations. To do so you can perform your data tranformation in your getData
function before passing results to the successHandler
.
For example: we need to allow the user to select his country of origin. We want to show to the user Prefer Not to Say option as the first one no matter what they type for the search. To do so we can returned our response sorted ascending by name and reshuffle options programmatically using the following code: