\r\n```\r\n\r\nBut 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.\r\n\r\nAny idea ?\r\n", "htmlContent" : "

Hi,

\n

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

\n
<nuxeo-document-suggestion  value=\"\"\n                            label=\"[[i18n('manufacturing_summary.documentsLocations')]]\"\n                            multiple=\"true\"\n                            min-chars=\"0\"\n                            role=\"widget\"\n                            placeholder=\"[[i18n('dublincoreEdit.directorySuggestion.placeholder')]]\"\n                            operation=\"SearchHWProjects\"\n                            on-value-changed=\"_documentsLocationsUpdated\"\n></nuxeo-document-suggestion>\n\n<nuxeo-document-suggestion  value=\"{{document.properties.mfs:documents}}\"\n                            label=\"[[i18n('manufacturing_summary.documents')]]\"\n                            multiple=\"true\"\n                            min-chars=\"0\"\n                            role=\"widget\"\n                            placeholder=\"[[i18n('dublincoreEdit.directorySuggestion.placeholder')]]\"\n                            operation=\"SearchHWPDocuments\"\n                            query-results-filter=\"[[_filterDocuments]]\"\n></nuxeo-document-suggestion>\n\n<script>\n    Polymer({\n        is: 'nuxeo-manufacturing_summary-create-layout',\n        behaviors: [Nuxeo.LayoutBehavior],\n        properties: {\n            /**\n             * @doctype manufacturing_summary\n             */\n            document: Object,\n        },\n\n        _documentsLocationsUpdated: function(event){\n            if (event && event.detail && event.detail.value) {\n                docsLocations = event.detail.value;\n            }\n        },\n\n        _filterDocuments: function(element, index, array){\n            let isInDocsLocations = false;\n\n            if(element && element.parent && docsLocations){\n                isInDocsLocations = (docsLocations == element.parent);\n            }\n\n            return isInDocsLocations;\n        },\n    });\n</script>\n
\n

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.

\n

Any idea ?

" }, { "id" : "fe84e4d0-eee8-4f41-b321-1562b084b5aa", "label" : "1", "active" : false, "author" : { "uid" : "371e779b-0aa3-49f7-8b07-17732da09314", "name" : "371e779b-0aa3-49f7-8b07-17732da09314", "email" : "corentin.bourdon@arturia.com", "firstName" : "Corentin", "lastName" : "Bourdon", "title" : "Member", "score" : 227, "disabled" : false, "virtual" : false, "badgeCount" : null, "notifications" : { "email" : { "name" : "email", "address" : "corentin.bourdon@arturia.com", "notifs" : [ "EditMyAnswer", "CommentMyAnswer", "EditMyQuestion", "NewQuestionComment", "AnswerMyQuestion", "WeeklyDigest", "VoteMyQuestion", "BadgeAwarded", "VoteMyAnswer", "TagMyQuestion", "CommentMyQuestion", "NewQuestion", "NewAnswerComment", "NewAnswer" ] }, "phone" : null }, "badges" : [ "editor", "commentator" ], "loginCount" : 6, "lastLogin" : 0, "avatarUrl" : "//www.gravatar.com/avatar/931a21fabff406852b2af84a88b36969?d=mm&s=%s" }, "created" : "2020-08-05T13:22:43.68Z", "createdAt" : "08/05/2020", "title" : "Filter data in document suggestion", "content" : "Hi,\r\n\r\nI'm trying to reproduce [this how-to](https://doc.nuxeo.com/nxdoc/how-to-filter-data-in-directory-suggestion/), but with a [document suggestion widget](https://www.webcomponents.org/element/nuxeo/nuxeo-ui-elements/elements/nuxeo-document-suggestion) instead of a directory suggestion widget. Here is my code :\r\n\r\n```\r\n\r\n\r\n\r\n\r\n\r\n```\r\n\r\nBut 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.\r\n\r\nAny idea ?\r\n", "htmlContent" : "

Hi,

\n

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

\n
<nuxeo-document-suggestion  value=\"\"\n                            label=\"[[i18n('manufacturing_summary.documentsLocations')]]\"\n                            multiple=\"true\"\n                            min-chars=\"0\"\n                            role=\"widget\"\n                            placeholder=\"[[i18n('dublincoreEdit.directorySuggestion.placeholder')]]\"\n                            operation=\"SearchHWProjects\"\n                            on-value-changed=\"_documentsLocationsUpdated\"\n></nuxeo-document-suggestion>\n\n<nuxeo-document-suggestion  value=\"{{document.properties.mfs:documents}}\"\n                            label=\"[[i18n('manufacturing_summary.documents')]]\"\n                            multiple=\"true\"\n                            min-chars=\"0\"\n                            role=\"widget\"\n                            placeholder=\"[[i18n('dublincoreEdit.directorySuggestion.placeholder')]]\"\n                            operation=\"SearchHWPDocuments\"\n                            query-results-filter=\"[[_filterCountries]]\"\n></nuxeo-document-suggestion>\n\n<script>\n    Polymer({\n        is: 'nuxeo-manufacturing_summary-create-layout',\n        behaviors: [Nuxeo.LayoutBehavior],\n        properties: {\n            /**\n             * @doctype manufacturing_summary\n             */\n            document: Object,\n        },\n\n        _documentsLocationsUpdated: function(event){\n            if (event && event.detail && event.detail.value) {\n                docsLocations = event.detail.value;\n            }\n        },\n\n        _filterDocuments: function(element, index, array){\n            let isInDocsLocations = false;\n\n            if(element && element.parent && docsLocations){\n                isInDocsLocations = (docsLocations == element.parent);\n            }\n\n            return isInDocsLocations;\n        },\n    });\n</script>\n
\n

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.

\n

Any idea ?

" } ] }; Versioning.getActiveVersion = function() { var versions = this.versions; for (var i=0,len=versions.length;i

Select a revision to compare with:
Side by side diff