AnsweredAssumed Answered

how to implement hierarchical drop down list?

Question asked by zhasik92 on Nov 1, 2016
Latest reply on Nov 9, 2016 by douglascrp

Hello, Alfresco Community!

 

I'm trying to implement hierarchical drop down list to classify custom business process.

I need something like this:

     1. Some 1 level string

          1.1 Some 2 level string

          1.2 ......

     2. Another 1 level string

          2.1 ....

 

I've decided to create content model for this:

<type name="scr:catalogBase">
    <title>Catalog Base</title>
    <parent>dl:dataListItem</parent>
    <properties>
        <property name="scr:title">
            <type>d:text</type>
            <mandatory>true</mandatory>
        </property>
        <property name="scr:ordering">
            <type>d:int</type>
            <mandatory>true</mandatory>
        </property>
        <property name="scr:isLeaf">
            <type>d:boolean</type>
            <mandatory>true</mandatory>
        </property>
    </properties>
    <associations>
        <child-association name="scr:catalogElements">
            <title>childAssociation</title>
            <source>
                <mandatory>false</mandatory>
                <many>true</many>
            </source>
            <target>
                <class>scr:catalogBase</class>
                <mandatory>false</mandatory>
                <many>true</many>
            </target>
        </child-association>
    </associations>
</type>

 

<type name="scr:catalogBase">
    <title>Catalog Base</title>
    <parent>dl:dataListItem</parent>
    <properties>
        <property name="scr:title">
            <type>d:text</type>
            <mandatory>true</mandatory>
        </property>
        <property name="scr:ordering">
            <type>d:int</type>
            <mandatory>true</mandatory>
        </property>
        <property name="scr:isLeaf">
            <type>d:boolean</type>
            <mandatory>true</mandatory>
        </property>
    </properties>
    <associations>
        <child-association name="scr:catalogElements">
            <title>childAssociation</title>
            <source>
                <mandatory>false</mandatory>
                <many>true</many>
            </source>
            <target>
                <class>scr:catalogBase</class>
                <mandatory>false</mandatory>
                <many>true</many>
            </target>
        </child-association>
    </associations>
</type>

Some pseudo code to show how to I'm creating list:

var mySiteNode = s nodeService.getNode(noderef);
var node1 = mySiteNode.createNode("Some 1 level");
var node2 = mySiteNode.createNode("Another 1 level");
node1.createNode("some 2 level");

node2.createNode("another 2 level");


 

I can't find any solution how to make hierarchical drop down list for my content model. Is there any OOTB solution for this?

I'm beginner with alfresco. Maybe you could provide a better solution to create hierarchical drop down list against my.

Thanks

Outcomes