p-Accordion: Multiple and Programmatic Change

Post Reply
Posts: 1
Joined: 28 Dec 2017, 14:23

12 Feb 2018, 20:19


According to PrimeNG documentation, it's necessary using an array of numbers that define the indexes of active tabs. However, there is no example about its usage, and I am having issues with that.
I have a cancel button that have to open two accordions if clicked. However, it does not work when I click. It has no action. Is there any behavior that I am missing, or doing it wrongly?

- My accordion:

Code: Select all

<p-accordion [activeIndex]="accordionIndex" [multiple]="true" (onOpen)="onTabOpen($event)">
            <p-accordionTab header="Header 0" [selected]="true">

            <p-accordionTab header="Header 1">

          <p-accordionTab header="Header 2">
         <p-accordionTab header="Header 3">

- My button:

Code: Select all

<button pButton type="button" label="Cancelar" (click)="onCancel()"></button>
- My .ts file

Code: Select all

    accordionIndex: number[ ] = [-1];
 onCancel() {
        this.accordionIndex = [0,3];

Posts: 603
Joined: 12 Sep 2017, 10:44

20 Feb 2018, 12:47

I tried with your code and it's work. Please can you create a plunker (http://plnkr.co/edit/6q5v84DWolH6DeAdi70w?p=preview)?

Post Reply

Return to “Paradise - PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest