admin管理员组文章数量:1334672
I am working with Angular
and PrimeNG
and have a nested accordion, with one accordion inside another. The issue is that when I open the inner accordion and leave it open, and then open and close the outer accordion, the inner accordion closes very quickly, almost like a "flash," and does not stay open. I have set the outer accordion to start with the first tab open (`[activeIndex]="0"`), and the inner accordion also has an active tab. However, when I click on the outer accordion and close it, then open it again, the inner accordion closes again. How can I prevent this behavior and keep the inner accordion open when the outer accordion is opened again? Here is my code:
<p-accordion [activeIndex]="0">
<p-accordionTab header="Header I">
<div>
<p-accordion [activeIndex]="0">
<p-accordionTab header="Header I">
<p>111</p>
<p-accordion [activeIndex]="0">
<p-accordionTab header="Header I">
<p>222</p>
</p-accordionTab>
</p-accordion>
</p-accordionTab>
</p-accordion>
</div>
</p-accordionTab>
</p-accordion>
I am working with Angular
and PrimeNG
and have a nested accordion, with one accordion inside another. The issue is that when I open the inner accordion and leave it open, and then open and close the outer accordion, the inner accordion closes very quickly, almost like a "flash," and does not stay open. I have set the outer accordion to start with the first tab open (`[activeIndex]="0"`), and the inner accordion also has an active tab. However, when I click on the outer accordion and close it, then open it again, the inner accordion closes again. How can I prevent this behavior and keep the inner accordion open when the outer accordion is opened again? Here is my code:
<p-accordion [activeIndex]="0">
<p-accordionTab header="Header I">
<div>
<p-accordion [activeIndex]="0">
<p-accordionTab header="Header I">
<p>111</p>
<p-accordion [activeIndex]="0">
<p-accordionTab header="Header I">
<p>222</p>
</p-accordionTab>
</p-accordion>
</p-accordionTab>
</p-accordion>
</div>
</p-accordionTab>
</p-accordion>
Share
Improve this question
asked Nov 20, 2024 at 7:55
ישראל גוטליבישראל גוטליב
112 bronze badges
1 Answer
Reset to default 0Try to handle the state based on the last activity, so you can reopen the accordion.
Use the onOpen
event to manage the activeIndexChange
and handle the last active state.
本文标签: Inner Accordion Closes When Outer Accordion is Toggled in Angular with PrimeNGStack Overflow
版权声明:本文标题:Inner Accordion Closes When Outer Accordion is Toggled in Angular with PrimeNG - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742373215a2462644.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论