Filter data in document suggestion

Hi,

I'm trying to reproduce this how-to, but with a document suggestion widget instead of a directory suggestion widget. Here is my code :

<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"
></nuxeo-document-suggestion>

<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]]"
></nuxeo-document-suggestion>

<script>
    Polymer({
        is: 'nuxeo-manufacturing_summary-create-layout',
        behaviors: [Nuxeo.LayoutBehavior],
        properties: {
            /**
             * @doctype manufacturing_summary
             */
            document: Object,
        },

        _documentsLocationsUpdated: function(event){
            if (event && event.detail && event.detail.value) {
                docsLocations = event.detail.value;
            }
        },

        _filterDocuments: function(element, index, array){
            let isInDocsLocations = false;

            if(element && element.parent && docsLocations){
                isInDocsLocations = (docsLocations == element.parent);
            }

            return isInDocsLocations;
        },
    });
</script>

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.

Any idea ?

0 votes

0 answers

63 views

ANSWER