Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Need to send text string to new row in expandable table

Avatar

Level 2

I have a table that is a summary of other choices made throughout the document.  For specific check boxes in the form, there is a defined phrase that needs to be sent to a new row in the summary table.

The general idea is that for checkbox:

form1.sfMain.sfContent.tableC2.Row1.cbC2b6

if (this.rawValue == "1") {

this.resolveNode('form1.sfApp6.tableApp6A._Row1').addInstance(1);

this.resolveNode("form1.sfApp6.tableApp6A.Row1[*].ddApp6A1c").rawValue = "Blue bottle";

}

This needs to be something I can specify for each applicable checkbox (each will have a different text string), but I don't know what the final count is going to be (depends on choices made by the user) so I can't delete rows in the table and start over every time.  It needs to be additive.

Any suggestions?

Message was edited by: cyndilynnrose

2 Replies

Avatar

Level 2

I tried to do a rowcount and then set the target row at rowcount+1, but then I couldn't figure out how to send the text to the target row.

//count rows

var numberOfRows = form1.sfApp6.tableApp6A.Row1.instanceManager.count;

//add row

this.resolveNode('form1.sfApp6.tableApp6A._Row1').addInstance(1);

//Set target

var targetRow = numberofRows+1;

Avatar

Level 2

For anyone needing the same thing, I found exactly what I needed:

http://www.truetechtroubleshooting.com/2012/02/advanced-expanding-tables-and-script.html

The hardest part of getting it working was figuring out how many parent levels I needed to add since I have a heavily layered form.