AnsweredAssumed Answered

Document list custom metadata - Displa property of type category

Question asked by dave84 on Sep 4, 2013
Latest reply on Sep 5, 2013 by dave84
Hi all.

I created my custom metadata templates in order to see custom metadata document and folder in Alfresco Share Document Library, as mentioned here:

<a href="http://docs.alfresco.com/4.1/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fdoclib-web-tier.html">http://docs.alfresco.com/4.1/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fdoclib-web-tier.html</a>

I created Custom JavaScript renderers and all works fine but i have a property in my model of type d:category and I want to display the category name (as in document details page) in document library list under the document/folder title. Now i can see only the nodeRef and i don't now how to get the category name from javascript render.

The definition in content model with property of type category (ni:sinistroStato) in my model:


<type name="ni:sinistro">
          <title>Cartellina sinistro</title>
          <parent>cm:folder</parent>
          <properties>
           <property name="ni:sinistroNominativo">
                <title>Nominativo</title>
                <type>d:text</type>
                <mandatory>false</mandatory>
             </property>
   <property name="ni:sinistroStato">
                <title>Stato</title>
                <type>d:category</type>
                <mandatory>true</mandatory>
             </property>
        </properties>
      </type>



My custom javascript render is


(function()
{
   /**
    * Alfresco Slingshot aliases
    */
    var $html = Alfresco.util.encodeHTML,
    $isValueSet = Alfresco.util.isValueSet;

   if (Alfresco.DocumentList)
   {   
        YAHOO.Bubbling.fire("registerRenderer",
        {
           propertyName: "ni_sinistro",
           renderer: function showMetadataDescription(record, label)
           {
        
                var jsNode = record.jsNode;     
              
        var desc = "";
      var sinistroNominativo = jsNode.properties["ni:sinistroNominativo"];
            if(sinistroNominativo){
                desc += '<span class="item" style="display:block; width:100%;">Nominativo: ' + sinistroNominativo + '</span>';
            }
            var sinistroStato = jsNode.properties["ni:sinistroStato"];
            if(sinistroStato && checkCustom(campiCustomDaMostrare,"sinistroStato")){
                desc += '<span class="item" style="display:block; width:100%;">Stato: ' + sinistroStato + '</span>';
            
            }

         return desc;
          }
      });
   }
})();


The return of jsNode.properties["ni:sinistroStato"] is the nodeRef of category, is it possible to see the name of category? How can I get the name in custom render javascript (or alternative methods)?

Thanks!

Outcomes