I'm trying to implement a countries auto suggest widget. For this, I've created a custom component which has an autocomplete field and have added a component property to define the countries as a CSV.
I've configured the autocomplete field as below:
However, this does not work, but if I try:
$("Form").scope().Form.items.autocompleteField.$$parent.properties.countriesCsv - there is a CSV being returned.
If I instead set the countries from a form load rule: eg data.$countries = "COUNTRY1, COUNTRY2", and then point the Reference Data Name to data.$countries, it works.
Is it possible to use the list of countries defined as a component property in the autocomplete widget?
Currently the Reference Data Name property of the Automcomplete widget accepts only a data path, you can't refer directly to item properties. So to get the equivalent of what you are trying to do with the component item property, instead add a data field to your component, and refer to that data field in the Autocomplete. You can then override the calculation rule of the data field in your form to either (a) supply the raw values, as you're currently doing in that test form or (b) dynamically derive the values based on some other data in the form, if you want to get more advanced.
Thanks Tim, I've implemented it with a data field for now.