This article was created in response to a support issue logged with K2. The content may include typographical errors and may be revised at any time without notice This article is not considered official documentation for K2 software and is provided “as is” with no warranties.
Unable to Set Display Value for AutoComplete control (w/Live Search enabled).
- Create a view
Add an autocomplete control
- Set Autocomplete control data source to a SmartObject (for example use a SmartObject that has ID and DisplayName properties)
- Configure the data source settings so that the value used is the 'ID' and the display is set to show 'DisplayName'
- Set Live Search to be checked or true
- Add a button
- Set a rule on the button click to transfer a value to the autocomplete
- Remove the init rule that populates the Autocomplete control (this is added automatically when the control is configured)
- Finish and Run the view and click the button.
At runtime the above configuration will result in the AutoComplete control resolving, but rather than show the configured 'DisplayName' property, the 'ID' property will always be displayed.
This is a known issue that is logged and will be fixed in a future K2 release. (Internal tracking ID: 848046).
There is a known workaround for this scenario. Add a separate action in the rules just prior to transferring data to the AutoComplete control. Add a populate control rule, set the filter based on the value about to be transferred to the control. This workaround provides the correct behavior and still allows for the desired live search performance.
Workaround Rule example:
On button click:
Populate Picker list control with data