Don't display the input document in a nuxeo-document-suggestion

Hi, I'm trying to don't display the input document in a document-suggestion component, using the [[document.uid]] property inside the query in the Repository.Query operation, but nuxeo doesn't receive this uid.

This is my code:

        <nuxeo-document-suggestion operation="Document.Query"
                                   input = "[[document]]"
                                   params='{"query": "SELECT * FROM Item WHERE ecm:uuid != '[[document.uid]]'"}'
                                   label="[[i18n('label.relation.pickDocument')]]"
                                   value="{{path}}" 
                                   min-chars="0"
                                   result-formatter="[[myFormatter]]"
                                   selected-item="{{toDoc}}">
        </nuxeo-document-suggestion>

If I insert the code instead of the document property the query works and the input document doesn't display. Furthermore, if I show [[document.uid]] in a normal div, nuxeo receive the id correctly.

0 votes

2 answers

998 views

ANSWER



Try to add in the polymer section:

ready: function() {
      this.nxProvider = this.$.nxProvider; 
    },
0 votes



It happens the next error: TypeError: cyclic object value
11/08/2019


Hello,

  • Create a page provider to list the document you need to search for, with a predicate linked to the ecm:uuid propertty, with !=
  • In your document suggestion element, use the pageProvider attribute to point to the previous page provider
  • In your document type layout, create a nuxeo-page-provider element
    <nuxeo-page-provider id="nxProvider" provider="<YOUR_PAGE_PROVIDER>" params="[[_computeParams(document)]]" enrichers="thumbnail, permissions" schemas="dublincore,common,uid" page-size="20" headers="{"X-NXfetch.document": "properties", "X-NXtranslate.directoryEntry": "label"}" auto=""></nuxeo-page-provider>
    
  • Add the following code in the polymer section
    _computeParams: function (document) {
    return document ? {system_uuid: this.document.uid} : {};
    },
    
0 votes



In the document suggestion element I have to declare page-provider = [[nxProvider]] right? It doesn't work
11/07/2019