cancel
Showing results for 
Search instead for 
Did you mean: 

I want to get the full path of A category node .

nyszhangyong
Champ in-the-making
Champ in-the-making
hello

I want to get the full path of A category node .
For example : Categories/Regions/OCEANIA/Polynesia/A


Please help me modify the "testCategoriesQuery.get.json.ftl", let me get the full path to the A category  node .

testCategoriesQuery.get.js
 
if (node.hasAspect('cm:generalclassifiable')){
                nodeCategories=node.properties["cm:categories"];
}


testCategoriesQuery.get.json.ftl

<#escape x as jsonUtils.encodeJSONString(x)>
{
   "catnodes  ":
   [
      <#list catnodes  as catnode>
      {
         "id": "${catnode.id}",
         "name": "${catnode.name}",
         "nodeRef": "${catnode.nodeRef}"
      }<#if catnode_has_next>,</#if>
      </#list>
   ]
}
</#escape>
2 REPLIES 2

jpotts
World-Class Innovator
World-Class Innovator
A category is a node like any other node and therefore you can ask it for its displayPath. For example, this would give you the path of the first category set on the document:
var somePath = node.properties['cm:categories'][0].displayPath;

I notice that you are posting a lot of JavaScript API questions. You may want to refer to the JavaScript API page on the wiki. It is quite helpful.

Also, if you haven't found it, I highly recommend you download and install the JavaScript Console. It lets you test out the JavaScript API interactively directly within the Alfresco Share interface.

Jeff

nyszhangyong
Champ in-the-making
Champ in-the-making
Thanks Jeff
As you say ,
I have installed the javascript console,
During this time,
Under your guidance ,
I feel more and more confidence in the development of alfresco .