We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error when adding accordion data dynamically

When using the following:
let accordionObj: Accordion = new Accordion({
items: [
{ header: 'Accordion Header', content: 'Accordion Content' },
{ header: 'Accordion Header', content: 'Accordion Content' },
{ header: 'Accordion Header', content: 'Accordion Content' }
]
});
accordionObj.appendTo('#toDoAccordion');
I get the following issues: The accordion header gets darker each time I click until it is no longer visible.  I also get TypeError: Cannot read property 'content' of undefined, in console.  Any help would appreciated

Regards

Attachment: Screenshot_20190404_at_15.36.50_21ef0411.zip

1 Reply

KK Karthigeyan Krishnamurthi Syncfusion Team April 5, 2019 09:25 AM UTC

Hi Rikard, 
 
Greetings from Syncfusion. 
 
We have prepared the sample to dynamically add the Accordion item and kindly refer the below API link. 
 
onChange() { 
    this.acrdnInstance.addItem({ 
      content: ' JavaScript (JS) is an interpreted computer programming language. ', 
      header: ' JavaScript ' 
    }); 
  } 
 
 
Regards, 
Karthi 


Loader.
Live Chat Icon For mobile
Up arrow icon