[select2] Filter the values of widget "Single Directory Suggestion"
The Nuxeo documentation is insufficient on this subject. I can not use it properly.
I would have as a result:
Can we do this stuff?
The “Formatter Suggestion” or “Selection Formatter“ are only to format the diplayed entries and won't do any filtering.
I am not sure to understand which kind of filtering you'd like to achieve but just know that the underlying automation operation that returns the suggestions is
You might want to write your own opeartion based on it and use it by specifying its operation id to the select2 widget.
First we need to create a Schema and we need to get its entries in database. Then the values that you want to show in dropdown should be written in some csv file and load it through directories-contrib.xml.
Declare your schema in core-contrib.xml like
<schema name=“FolderTypes” prefix=“medicalscholarlyarticle”
Define your schema somewhat like
<xs:element name="id" type="xs:string"/> <xs:element name="label_en" type="xs:string"/> <xs:element name="obsolete" type="xs:integer" default="0"/> <xs:element name="ordering" type="xs:integer" default="10000000"/>
and directories-contrib.xml will look like
<directory name="folder_types"> <schema>your_schema</schema> <dataSource>java:/nxsqldirectory</dataSource> <cacheTimeout>3600</cacheTimeout> <cacheMaxSize>1000</cacheMaxSize> <table>table_name_in_DB</table> <idField>id</idField> <autoincrementIdField>false</autoincrementIdField> <dataFile>directories/your_csv_file.csv</dataFile> <createTablePolicy>always</createTablePolicy> </directory>
This one worked for me. Hope it resolves your problem.