07-09-2015 08:12 AM
Hi,
I wish to filter dynamically the results returned by the widget "single directory suggestion" using javascript select2 class.
I saw in your tutorial we could use "inline javascript" expressions called by "Formatter Suggestion" or "Selection Formatter". I want to be filtered through a metadata parameter data.
The Nuxeo documentation is insufficient on this subject. I can not use it properly.
I would have as a result:
before:
after:
Can we do this stuff?
Thanks
10-29-2015 07:57 AM
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
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.
10-29-2015 08:57 AM
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.
operationId=YouSuggestOperation
10-29-2015 09:36 AM
This blog post shows how to use an Automation Script to filter suggestion results.
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.