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
SOLVED

Panel.instanceManager.addInstance/removeInstance very slow

Avatar

Level 3

Hello,

 

I have following setup:

Bildschirmfoto 2021-11-09 um 15.17.48.png

The first input is a dropdown with entries 1 to 10. The following three inputs are placed into a panel named "panel_child". If the user selects the count of his children, the panel should be displayed in the count, he selected.

I wrote a rule for the dropdown if the value is changed with following code:

var childCount = this.value;
var panelChildCount = panel_child.instanceManager.instanceCount;
if (childCount > panelChildCount) {
var instancesToAdd = childCount - panelChildCount;
for (var i=0; i<instancesToAdd; i++) {
panel_child.instanceManager.addInstance();
}
} else if (childCount < panelChildCount) {
var instancesToRemove = panelChildCount - childCount;
for (var i=0; i<instancesToRemove; i++) {
panel_child.instanceManager.removeInstance(panel_child.instanceIndex);
}
}

If only one or two panels are to be added or deleted, it runs smoothly. However, when I need to add or delete many, it becomes very very slow.

Did I do anything wrong in my code?

 

Thanks for helping me!

Andrea

1 Accepted Solution

Avatar

Correct answer by
Employee

@ajur ,

I am also able to reproduce this issue on 6.5.10, when more than 3 instances are added or removed. Seems like a bug. Please log a support case so that it can be fixed. Thanks!

View solution in original post

2 Replies

Avatar

Correct answer by
Employee

@ajur ,

I am also able to reproduce this issue on 6.5.10, when more than 3 instances are added or removed. Seems like a bug. Please log a support case so that it can be fixed. Thanks!

Avatar

Level 3

Uhm, that's pity. I try to find a short-term solution myself for so long.