Reusable dialog definitions - How to make a component having multifield reusable
I have created a simple component called link-field under which i have a another node called link has a text field and pathfield. The .content.xml are :
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="cq:Widget"
xtype="multifieldpanel">
<items jcr:primaryType="cq:WidgetCollection">
<label
jcr:primaryType="cq:Widget"
allowBlank="{Boolean}false"
fieldLabel="Link Label"
name="./link/label"
xtype="textfield"/>
<destination
jcr:primaryType="cq:Widget"
allowBlank="{Boolean}false"
fieldLabel="Link Destination"
name="./link/destination"
xtype="pathfield"/>
</items>
I have created another component called multifieldLinkTest where i am calling this link component by mentioning path property /componentname.infinity.json and xtype cqinclude. here is the content.xml
<items jcr:primaryType="cq:WidgetCollection">
<link1
jcr:primaryType="cq:Widget"
collapsed="{Boolean}false"
collapsible="{Boolean}false"
title="Link1"
xtype="dialogfieldset">
<items jcr:primaryType="cq:WidgetCollection">
<fieldConfig
jcr:primaryType="cq:Widget"
path="/apps/te/components/widgets/link-field/link.infinity.json"
xtype="cqinclude"/>
</items>
</link1>
<link2
jcr:primaryType="cq:Widget"
collapsed="{Boolean}false"
collapsible="{Boolean}false"
title="Link2"
xtype="dialogfieldset">
<items jcr:primaryType="cq:WidgetCollection">
<fieldConfig
jcr:primaryType="cq:Widget"
path="/apps/te/components/widgets/link-field/link.infinity.json"
xtype="cqinclude"/>
</items>
</link2>
</items>
the problem is if in other component i add the same link node twice then in that values are not proper. its same for all the link nodes. let us suppose if you add three link node a,b and c. for each a, b and c we have label and destination field.
if i enter any value in a[link] it will be by default same for b[link] and c[link]. if suppose if you add any value in b or c it will be added all together like a[link],b[link].c[link] and will b same for these three nodes.
Is there any way through which we can store or read the proper values ??
Thanks,
Vipul