Customize nuxeo-assets-search-result.html

I want to customize the nuxeo-data-table that shows nuxeo-results in nuxeo-assets-search-results.html by adding a new column which displays a property of a parent document. I'm asking a solution to access to a parent document data in such widget. I' ve tried to get the parent data using a function that call the operation “Document.getParent” and return the property I need. In fact, I've added a new column that calls this function :

         <template>
        [[_getProperty(item)]]
        </template>
  </nuxeo-data-table-column>

function I used :

_getProperty: function(item) {

        this.currentItemId = item.uid;
        if (this.currentItemId != null && this.currentItemId != undefined) {
          this.$.fetchDocumentOperation
            .execute()
            .then(function(response) {
                this.input = response;
                if (this.input != null && this.input != undefined) {
                   this.$.getParentOperation.execute().then(function(response2) {
                      console.log(response2.properties["xpath"]);
                      return response2.properties["xpath"];
                   }.bind(this))
                   .catch(function(error) {
                     console.log("error:" + error);
                   }.bind(this));
                 }
               }.bind(this))
             .catch(function(error) {
                console.log("error:" + error);
             }.bind(this));

By this solution I was able to display the property I need in console but it's not displayed in interface.

0 votes

2 answers

1207 views

ANSWER



You should use something like

<nuxeo-data-table-column name="Parent" field="item.parentRef">
<template>
<nuxeo-document-suggestion value="[[item.parentRef]]" readonly="true"></nuxeo-document-suggestion>
</template>
</nuxeo-data-table-column>
0 votes



I want to display an other metadata not the parentRef
06/11/2020


Hello,

The simplest way to edit the default dam search is to import the Studio External Template called “Default Nuxeo DAM Configuration” in your project and edit the configuration (see screenshot)

Regards

0 votes



Thanks for your reply, But I need to know how can I get access to a parent document data in such widget
06/09/2020

I'm not sure that's the proper approach, I'd take a different one. If you need to use the parent object's metadata, you should also have it on your child objects. That metadata would be defined in a schema, which can be easily copied with an automation chain (Document.CopySchema). By doing so you will also be able to search for your documents using parent's metadata. That's covered in a University video, I believe it was "Content modeling options".
06/09/2020