cancel
Showing results for 
Search instead for 
Did you mean: 

Change root element in category picker control

woody
Champ in-the-making
Champ in-the-making
In my custom form I'm trying to set the root element of the category controls picker (control used for category selection by form engine) not to the root element of category tree, but on the root element of one of my custom category list.

Looking at the code in the category.ftl file

<script type="text/javascript">//<![CDATA[
(function()
{
   <@renderPickerJS field "picker" />
   picker.setOptions(
   {
      itemType: "cm:category",
      multipleSelectMode: ${(field.control.params.multipleSelectMode!true)?string},
      parentNodeRef: "alfresco://category/root",
      itemFamily: "category",
      maintainAddedRemovedItems: false,
      params: "${field.control.params.params!""}",
      createNewItemUri: "${field.control.params.createNewItemUri!}",
      createNewItemIcon: "${field.control.params.createNewItemIcon!}"
   });
})();
//]]></script>

Here the Picker class options as setted for retrieving all categories (and of course it works). Now I'm trying to change the line

      parentNodeRef: "alfresco://category/root",

Setting something like

      parentNodeRef: "alfresco://category/root/mycustomcategory",

but it doesn't work… any idea?
1 REPLY 1

mikeh
Star Contributor
Star Contributor
That parameter needs to be a nodeRef, not some kind of path!

The "alfresco://category/root" is a virtual nodeRef that saves a REST API call to the Repository to get the real nodeRef of the root node. You need to find the actual nodeRef of your required starting point, and the easiest way is via the node browser in the Explorer client.

Login as admin, then browse to: http://localhost:8080/alfresco/faces/jsp/admin/node-browser.jsp
Choose stores, then workspace://SpacesStore
Drill down into categoryRoot, then generalclassifiable and then down to your required category and make a node of the nodeRef

Thanks,
Mike