Skip to main content


 

Symptoms


Autocomplete vs Picker
 

Diagnoses


Here is our scenario of what we want to achieve:

We want a live search for a typed word (and if possible to enforce lets say to start a live search after x number of characters). The results should be shown while typing and not on control's lost focus. Also, we are looking for the most efficient way as the external system stores large amount of data and we don't want to stress it too much with frequent and large calls.

We have identified the following differences on the operation of Autocomplete control and Picker control, I would appreciate if you give as your feedback on the questions below:

Autocomplete - it loads all possible data in memory when the view is initialised and then it shows suggested results when the user starts typing a value. In this case we can select a method to be called and we can filter the method with the provided parameters. Also, we have noticed that selecting "Live Search" instead of initialising the control on view initialised, it performs the search while typing.
1. How does the "Live Search" works behind the scenes? Does it sends to the smartobject the value typed and searches the external system with the typed text? Or does it gets ALL the results back everytime you type and then K2 filters the typed text?
2. We have noticed that the autocomplete control accepts values that are not on the data source. Is there a way to restrict it to the resulted values or validate that it only accepts the datasource values?


Picker Control - When the control loses focus, it searches the datasource and shows the results. It validates and accepts values only from the datasource.
3. Does the Live search of autocomplete control and picker control work with the same way in the background (while calling the external system)? Which one is the most efficient for large amount of data? Does anyone searches the external system with the typed word?
4. Is there a way to search the datasource while typing rather on the lost focus?


5. Both of these controls have an option to "Cache the data". What kind of caching does it use, where is the data cached? For how long does it caches the data, can we force the system to cache the data again at any point, if required?











 

Resolution

Please find the answers to your questions below:

1. How does the "Live Search" works behind the scenes? Does it sends to the smart object the value typed and searches the external system
with the typed text? Or does it gets ALL the results back every time you type and then K2 filters the typed text?
A) It sends to the smart object the value typed and searches the external system with the typed text – calling SMO api

2. We have noticed that the autocomplete control accepts values that are not on the data source. Is there a way to restrict it to the resulted
values or validate that it only accepts the data source values?
A) Please confirm what you mean by this, as I tested this but do not get the explained behaviour. I possible please provide a scenario.

Picker Control -
When the control loses focus, it searches the data source and shows the results. It validates and accepts values only from the
data source.
Autcomplete is basically a textbox, it accepts all value inputted by the user. Currently, we don’t have a way to restrict/validate it to the
resulted values.

3. Does the Live search of autocomplete control and picker control work with the same way in the background (while calling the external
system)? Which one is the most efficient for large amount of data? Does anyone searches the external system with the typed word?
A) Picker doesn’t work exactly the same, but it is much more suited for large amount of data.

4. Is there a way to search the data source while typing rather on the lost focus?
A) Not sure if customer is asking about Autocomplete or picker control? Autocomplete searches while typing, you can specify a delay. Picker searches only when lost focus, no option to search while typing.

5. Both of these controls have an option to "Cache the data". What kind of caching does it use, where is the data cached? For how long does
it caches the data, can we force the system to cache the data again at any point, if required?
A) The ‘Cache the data’ option is part of SmartForms runtime. All it does is to save the data returned from a Populate list action.




 
Be the first to reply!

Reply