cancel
Showing results for 
Search instead for 
Did you mean: 

Child Association Javascript

ruben_arjonilla
Champ in-the-making
Champ in-the-making
Hi,

I have a question about associations.
Let me give an example, I have these 2 types, A and B, where B defines an association of A type documents
<type name="x:a">
   <title>A</title>
   <parent>cm:content</parent>
   <properties>
      <property name="x:campo1">
         <title>campo 1</title>
         <description>Descripción campo 1</description>
         <type>d:text</type>
         <mandatory>false</mandatory>
         <default></default>
      </property>
   </properties>
</type>
<type name="x:b">
   <title>B</title>
   <parent>cm:content</parent>
   <properties>
      <property name="x:campo2">
         <title>campo 2</title>
         <description>Descripción campo 2</description>
         <type>d:text</type>
         <mandatory>false</mandatory>
         <default></default>
      </property>
   </properties>

   <associations>
      <child-association name="x:asocA">
         <source>
            <mandatory>false</mandatory>
            <many>false</many>
         </source>
         <target>
            <class>x:a</class>
            <mandatory>false</mandatory>
            <many>false</many>
         </target>
      </child-association>
   </associations>
</type>

Now imagine that I have a document of type A and a document of type B
A1.txt
B1.txt

How can I create the child association in B?

normal association would be done as follows:
nodeB.createAssociation(nodeA, "x:asocA"); //Creates association between nodeB and nodeA

But this does not work for child-association, does not give me any error, but I'm going to nodeB, this has no association with the nodeA …

Thank you very much in advance.
1 REPLY 1

etoropov
Champ in-the-making
Champ in-the-making
Hi Rubem,

you solve this issue?