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

created event does not receive an event parameter

Hello, as subject states, is this a bug? 

I need to get access to the accordion instance, and I expect to access it through event object, I don't want to setup an ID to the component just to get access to it later on. Because I have several accordions in the same page, maybe inside different tabs, and I building the layout dynamically.

Pretty much every event we can use for every different component get an event object, why this is not the case?

Thank you,

Ernesto


1 Reply

VR Vijay Ravi Syncfusion Team January 20, 2023 10:15 AM UTC

Hi eyoon


You can access the accordion component instance by using this keyword as shown in the below code snippet.


Sample: https://stackblitz.com/edit/react-jomfzm-rytu9r?file=index.js


[Index.js]

 function oncreated() {

      console.log(this);

    }

 

    return (<div className='control-pane'>

      <div className='control-section accordion-control-section'>

        <div className='control Accordion-sample' style={margin: '25px 0' }}>

          {/* Render the Accoridon Component */}

          <AccordionComponent created={oncreated}>

            <AccordionItemsDirective>

              <AccordionItemDirective header={acrdnheader1} expanded={true} content={acrdnContent1}/>

              <AccordionItemDirective header={acrdnheader2} content={acrdnContent2}/>

              <AccordionItemDirective header={acrdnheader3} content={acrdnContent3}/>

            </AccordionItemsDirective>

          </AccordionComponent>

        </div></div>

    </div>);


Regards,

Vijay Ravi


Loader.
Live Chat Icon For mobile
Up arrow icon