08-10-2020 05:28 AM
Hi,
This is a follow-up of this question, I am creating a new one because I'm trying a different approach. You should read it to have the first part of the story.
In short : I've got a document suggestion widget in the creation form of an "index" document which will summarize all the documents for a given project. This widget searches for documents by calling a custom operation. This custom operation has a "parentsIds" parameter which serves as a filter, so that you don't have to scroll through all documents on the Nuxeo instance, but only the ones that are related to the project.
At first I tried to pass the id of the "index" document being created so I could get its parent (that was the first question if you haven't read it), but the document does not have an id yet in the creation form, so I added another document suggestion widget to select folders in which the second widget is going to search.
This new widget has a valueChanged listener updating the params.
Here are the two widgets :
<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 id="documentSuggestionWidget"
value="{{document.properties.mfs:documents}}"
label="[[i18n('manufacturing_summary.documents')]]"
multiple="true"
min-chars="0"
role="widget"
placeholder="[[i18n('dublincoreEdit.directorySuggestion.placeholder')]]"
operation="SearchDocuments"
params="[[params]]"
></nuxeo-document-suggestion>
and the corresponding script :
<script>
Polymer({
is: 'nuxeo-manufacturing_summary-create-layout',
behaviors: [Nuxeo.LayoutBehavior],
properties: {
/**
* @doctype manufacturing_summary
*/
document: Object,
params: {
type: Object,
value: {'doctype': 'hwp_document', 'parentsIds': ''},
}
},
_documentsLocationsUpdated: function (event) {
if (event && event.detail && event.detail.value) {
this.params.parentsIds = JSON.stringify(event.detail.value);
}
},
});
</script>
Everything is working fine, the Polymer and the widget's params properties are updated when a parent is selected in the "filter" widget, BUT the operation is always called with the first specified parameters, i.e. the hard-coded value in the Polymer properties, no matter how many times it is modified... Weird right ?
Any help welcome ! Have a good day
Attention: Blogs & Forums are in READ-ONLY mode from Oct 9-19 as we transition to our new platform. Learn more.
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.