cancel
Showing results for 
Search instead for 
Did you mean: 

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

iker_nicolas
Champ on-the-rise
Champ on-the-rise

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.

4 REPLIES 4

Gregory_Carlin
Elite Collaborator
Elite Collaborator

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} : {};
    },

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

Gregory_Carlin
Elite Collaborator
Elite Collaborator

Try to add in the polymer section:

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

It happens the next error