cancel
Showing results for 
Search instead for 
Did you mean: 

how to implement hierarchical drop down list?

zhasik92
Champ on-the-rise
Champ on-the-rise

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

3 REPLIES 3

angelborroy
Community Manager Community Manager
Community Manager

Maybe you can find some component ready for your requirements:

GitHub - rjmfernandes/share-custom-form-controls: This project contains a couple of reusable custom ...

5 Alfresco picklist plugins you can’t miss • SoftwareLoop

Or you can inspect that projects source code to build your own.

Hyland Developer Evangelist

vikash_patel
Star Contributor
Star Contributor

you can use properties tag like this to get DropDown List

<property name="scr:typeOfDonation">

             <type>d:text</type>

             <default>Donation</default>

  <constraints>

       <constraint type="LIST">

            <parameter name="allowedValues">

                      <list>

                          <value>Donation</value>

                          <value>Accomodation</value>

                           <value>Meeting</value>

                      </list>

                </parameter>

       </constraint>

    </constraints>

  </property>

douglascrp
World-Class Innovator
World-Class Innovator