<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Filter data in document suggestion in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/filter-data-in-document-suggestion/m-p/320921#M7922</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm trying to reproduce &lt;A href="https://doc.nuxeo.com/nxdoc/how-to-filter-data-in-directory-suggestion/"&gt;this how-to&lt;/A&gt;, but with a &lt;A href="https://www.webcomponents.org/element/nuxeo/nuxeo-ui-elements/elements/nuxeo-document-suggestion"&gt;document suggestion widget&lt;/A&gt; instead of a directory suggestion widget. Here is my code :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;nuxeo-document-suggestion  value=""
							label="[[i18n('manufacturing_summary.documentsLocations')]]"
							multiple="true"
							min-chars="0"
							role="widget"
							placeholder="[[i18n('dublincoreEdit.directorySuggestion.placeholder')]]"
							operation="SearchHWProjects"
							on-value-changed="_documentsLocationsUpdated"
&amp;gt;&amp;lt;/nuxeo-document-suggestion&amp;gt;

&amp;lt;nuxeo-document-suggestion  value="{{document.properties.mfs:documents}}"
							label="[[i18n('manufacturing_summary.documents')]]"
							multiple="true"
							min-chars="0"
							role="widget"
							placeholder="[[i18n('dublincoreEdit.directorySuggestion.placeholder')]]"
							operation="SearchHWPDocuments"
							query-results-filter="[[_filterDocuments]]"
&amp;gt;&amp;lt;/nuxeo-document-suggestion&amp;gt;

&amp;lt;script&amp;gt;
	Polymer({
		is: 'nuxeo-manufacturing_summary-create-layout',
		behaviors: [Nuxeo.LayoutBehavior],
		properties: {
			/**
			 * @doctype manufacturing_summary
			 */
			document: Object,
		},
		
		_documentsLocationsUpdated: function(event){
			if (event &amp;amp;&amp;amp; event.detail &amp;amp;&amp;amp; event.detail.value) {
				docsLocations = event.detail.value;
			}
		},
	
		_filterDocuments: function(element, index, array){
			let isInDocsLocations = false;
	
			if(element &amp;amp;&amp;amp; element.parent &amp;amp;&amp;amp; docsLocations){
				isInDocsLocations = (docsLocations == element.parent);
			}
	
			return isInDocsLocations;
		},
	});
&amp;lt;/script&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But when I select a parent document in the first widget, the filter does not take effect in the second one, I can still see all the documents.&lt;/P&gt;
&lt;P&gt;Any idea ?&lt;/P&gt;</description>
    <pubDate>Wed, 05 Aug 2020 13:22:43 GMT</pubDate>
    <dc:creator>Corentin_Bourdo</dc:creator>
    <dc:date>2020-08-05T13:22:43Z</dc:date>
    <item>
      <title>Filter data in document suggestion</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/filter-data-in-document-suggestion/m-p/320921#M7922</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I'm trying to reproduce &lt;A href="https://doc.nuxeo.com/nxdoc/how-to-filter-data-in-directory-suggestion/"&gt;this how-to&lt;/A&gt;, but with a &lt;A href="https://www.webcomponents.org/element/nuxeo/nuxeo-ui-elements/elements/nuxeo-document-suggestion"&gt;document suggestion widget&lt;/A&gt; instead of a directory suggestion widget. Here is my code :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;&amp;lt;nuxeo-document-suggestion  value=""
							label="[[i18n('manufacturing_summary.documentsLocations')]]"
							multiple="true"
							min-chars="0"
							role="widget"
							placeholder="[[i18n('dublincoreEdit.directorySuggestion.placeholder')]]"
							operation="SearchHWProjects"
							on-value-changed="_documentsLocationsUpdated"
&amp;gt;&amp;lt;/nuxeo-document-suggestion&amp;gt;

&amp;lt;nuxeo-document-suggestion  value="{{document.properties.mfs:documents}}"
							label="[[i18n('manufacturing_summary.documents')]]"
							multiple="true"
							min-chars="0"
							role="widget"
							placeholder="[[i18n('dublincoreEdit.directorySuggestion.placeholder')]]"
							operation="SearchHWPDocuments"
							query-results-filter="[[_filterDocuments]]"
&amp;gt;&amp;lt;/nuxeo-document-suggestion&amp;gt;

&amp;lt;script&amp;gt;
	Polymer({
		is: 'nuxeo-manufacturing_summary-create-layout',
		behaviors: [Nuxeo.LayoutBehavior],
		properties: {
			/**
			 * @doctype manufacturing_summary
			 */
			document: Object,
		},
		
		_documentsLocationsUpdated: function(event){
			if (event &amp;amp;&amp;amp; event.detail &amp;amp;&amp;amp; event.detail.value) {
				docsLocations = event.detail.value;
			}
		},
	
		_filterDocuments: function(element, index, array){
			let isInDocsLocations = false;
	
			if(element &amp;amp;&amp;amp; element.parent &amp;amp;&amp;amp; docsLocations){
				isInDocsLocations = (docsLocations == element.parent);
			}
	
			return isInDocsLocations;
		},
	});
&amp;lt;/script&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But when I select a parent document in the first widget, the filter does not take effect in the second one, I can still see all the documents.&lt;/P&gt;
&lt;P&gt;Any idea ?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Aug 2020 13:22:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/filter-data-in-document-suggestion/m-p/320921#M7922</guid>
      <dc:creator>Corentin_Bourdo</dc:creator>
      <dc:date>2020-08-05T13:22:43Z</dc:date>
    </item>
  </channel>
</rss>

