Accordion Panel active index throwing error

UI Components for Angular
Post Reply
prtkvalecha
Posts: 1
Joined: 20 Mar 2023, 11:23

20 Mar 2023, 11:37

In accordion panel, to mark a panel active there is a property activeIndex. The activeIndex property is a number property as per the documentation in primeng. I have written a piece of logic to find active index of panel when the position of the panel changes but the primeng code is throwing an error where it is trying to call array function(includes) on activeIndex property(this._activeIndex.includes) which is a number property. updateSelectionState() function inside which this line is being called.

janieserna
Posts: 3
Joined: 25 Jul 2023, 08:38

25 Jul 2023, 21:04

Hello,
I think one way to debug this issue is to add some console.log statements in your code to print out the value of activeIndex and check whether it's a number or an array when the error occurs. You could also check the code that modifies the activeIndex property to make sure it's not accidentally converting it to an array.

Alternatively, you could try setting the activeIndex property directly to a number instead of an array, like this:

Code: Select all

this.activeIndex = 0; // Set the active index to the first panel
This should ensure that the activeIndex property remains a number and doesn't get converted to an array.

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests