12-16-2021 03:30 AM
I have defined an vocabulary with the following schema:
<?xml version="1.0"?>
<xs:schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:nxsv="http://www.nuxeo.org/ecm/schemas/core/validation/"
xmlns:ref="http://www.nuxeo.org/ecm/schemas/core/external-references/"
targetNamespace="de.knipp.nuxeo.currencies">
<xs:element name="id" type="xs:string"/>
<xs:element name="label" type="xs:string"/>
<xs:element name="obsolete" type="xs:integer" default="0"/>
<xs:element name="ordering" type="xs:integer" default="10000000"/>
</xs:schema>
My test data in CSV format is the following:
id,label,obsolete,ordering
eur,EUR,0,1
centeur,centEUR,0,2
usd,USD,0,3
centusd,centUSD,0,4
Everything works fine: creating and editing my data in the WEBUI.
But when I want to display the value of the data, only the id is displayed (small letters instead of the camel string). I use the following code:
<div role="widget" hidden$="[[!document.properties.rfs:currency]]">
<label>[[i18n('com.mycompany.nuxeo.richfile.currency')]]</label>
<div name="currency">[[document.properties.rfs:currency]]</div>
</div>
How can I improve the code above to display the label of the currency?
12-21-2021 10:54 AM
If you want the REST API to return the label, you need to define a directoryResolver in your schema (named "rfs" in your case). Explained here: https://doc.nuxeo.com/nxdoc/field-constraints-and-validation/#reference-to-nuxeo-directoryvocabulary...
04-02-2022 06:55 AM
Benjamin, thanks for your response (and sorry for the late response).
12-21-2021 11:14 AM
Hello,
You should use the nuxeo-directory-suggestion
element for your property so that the ID is resolved with the corresponding label:
<nuxeo-directory-suggestion value="{{document.properties.rfs:currency}}" label="[[i18n('com.mycompany.nuxeo.richfile.currency')]]" min-chars="0" directory-name="<NAME-Of-YOUR-VOCABULARY>" name="currency" role="widget"></nuxeo-directory-suggestion>
Regards
04-02-2022 04:20 AM
Gregory, thanks for your answer (and sorry for the late response).
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.