How to create a component which has multiple parsys based on a multifield? | Community
Skip to main content
vigiaemnewbie
Level 2
April 3, 2019

How to create a component which has multiple parsys based on a multifield?

  • April 3, 2019
  • 1 reply
  • 13460 views

I am creating a component wherein the component will render multiple parsys based on a multifield, i.e., if I add three multifields then three parsys will be rendered on the page. I am using the following code to iterate and display multiple parsys on the page:

Here I am storing a list in Java based on number of items in the multifield. I am storing a value of tab+i in the list which mean the values stored are tab1, tab2 etc. and I am using each item of the list as the parsys path in jcr which gives the following structure:

The various nodes tab1, tab2, tab3 are the parsys generated from the above sightly code. These parsys only appear when components are added under them so each of them contain one component. The problem arises when the author deletes one multifield value from the dialog. The dialog now contains only 2 multifields but the parsys nodes persist in the jcr. This inconsistency between the nodes and the multifields is throwing error and causing the component to break. I need to maintain exactly as many nodes as there are multifields in my dialog.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

smacdonald2008
Level 10
April 3, 2019

When you delete a MF section from the dialog - the nodes under /content/<youpath> should reflect that - so if you have 2 MF sections - there should be 2 nodes under /content/<yourpath>.

The above illustration shows the JCR nodes when there are only 2 MF sections.

Are you using granite/ui/components/coral/foundation/form/multifield?

vigiaemnewbie
Level 2
April 4, 2019

Yes I am using granite/ui/components/coral/foundation/form/multifield but I am not talking about the nodes created for each multifield item. I am talking about the parsys created for each multifield item through the above sightly code. The multifield nodes are behaving as expected, but the parsys nodes are not getting deleted along with the multifield sections. In the image of the nodes "tabList" is the parent node for my multifield and tab1, tab2, tab3 are the parsys nodes created by the sightly code.

Level 5
June 3, 2020

Thanks smacdonald2008​.

I've raised this issue with customer support and am awaiting their response.  Incidentally, it appears if we create the parsys items (eg text) under the itemX node. The parsys items will also get wiped out everytime we update ANY fields in the dialog.  The multifield doesn't seem to support child nodes.


can you please let me know if you have found any solution ?