p-Accordion: Multiple and Programmatic Change

Forum rules
Please note that response time for technical support is within 3-5 business days.
Post Reply
logicsp
Posts: 1
Joined: 28 Dec 2017, 14:23

12 Feb 2018, 20:19

Hello,

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">
                <app-new-services-cover></app-new-services-cover>
            </p-accordionTab>

            <p-accordionTab header="Header 1">
           </p-accordionTab>

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

<p-accordion>
...
- 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];
    }
    

merve7
Posts: 861
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 5 guests