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

Removing Rows

Avatar

Level 3

I have a question about deleting rows. I created a table that allow a user to add or delete rows. I added a delete button on the row that I would like to duplicate. This button cannot delete the row that it is contained in. Is there a way that the delete row button can delete the row that contains it as well?

3 Replies

Avatar

Level 3

Hello Radzmar,

Thank you for the sample pdf, it was a big help! I have another question. Is there a way to setFocus on the first field in the newly created row when the add button is clicked?

Thanks,

Ricky

Avatar

Level 10

Hi Ricky,

yes this is possible, !

Assuming your table "MyTable" has repeated rows "Row" with a textfield "Name" the script in you add row button would look this way:


// Add 1 row
MyTable._Row.addInstance(1);


// Set focus on textfield in newly added row


xfa.host.setFocus(xfa.resolveNode("MyTable.Row[" + _Row.count - 1 + "].Name").somExpression);