Autocomplete - How to define DS

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2015 05:26 PM
Hi,
I'm trying to define an autocomplete field which will be filled by few items.
I've seen few related subjects guides/tutorials around and then I set this at share-config-custom:
I left it with {path} on purpose as I would like to know what should I put in the {path} to make it works.
I just didn't get how it works, what kind of file should be defined as my datasource.
Can it be a .TXT with a list of items in few lines?
What am I missing?
I'm trying to define an autocomplete field which will be filled by few items.
I've seen few related subjects guides/tutorials around and then I set this at share-config-custom:
<field id="id:prop_testauto" mandatory="false" read-only="false"> <control template="/org/alfresco/components/form/controls/autocomplete.ftl"> <control-param name="ds">{path}</control-param>
I left it with {path} on purpose as I would like to know what should I put in the {path} to make it works.
I just didn't get how it works, what kind of file should be defined as my datasource.
Can it be a .TXT with a list of items in few lines?
What am I missing?
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-02-2015 09:01 PM
Hi augustodelucena,
What version of Alfresco are you using? Is the autocomplete.ftl you are referencing a standard component or a custom control you've added in?
Assuming that you're using a control that's built on the YUI2 Autocomplete and your ftl works in a similar fashion to the old control from the Forms FDK (e.g. like this https://code.google.com/p/alfresco-forms-service-examples/source/browse/trunk/share/source/web/WEB-I... ), then the value you pass to the control-param ds needs to be a valid argument for the YAHOO.util.XHRDataSource constructor. This would be a url referencing a service that will return a JSON response in the format
So you can simply create a new webscript (if you don't have one already) that will return a static list - or perhaps read a file to create the list - in the format above. You would then use the url of this webscript as the parameter to your ds param.
Regards
Steven
What version of Alfresco are you using? Is the autocomplete.ftl you are referencing a standard component or a custom control you've added in?
Assuming that you're using a control that's built on the YUI2 Autocomplete and your ftl works in a similar fashion to the old control from the Forms FDK (e.g. like this https://code.google.com/p/alfresco-forms-service-examples/source/browse/trunk/share/source/web/WEB-I... ), then the value you pass to the control-param ds needs to be a valid argument for the YAHOO.util.XHRDataSource constructor. This would be a url referencing a service that will return a JSON response in the format
{ "results": [ {"value": "value1"}, {"value": "value2"}, {"value": "value3"} ]}
So you can simply create a new webscript (if you don't have one already) that will return a static list - or perhaps read a file to create the list - in the format above. You would then use the url of this webscript as the parameter to your ds param.
Regards
Steven
