<SfAccordion @ref="AcrdnObj">
</AccordionItems>
...
<div class="search-filter">
<div class="search-box search-box-button">
<SfButton Disabled="@IsBusy" @onclick="SearchClicked">Search</SfButton>
<SfButton @onclick="CancelClicked">Cancel</SfButton>
</div>
</div>
</div>
</ContentTemplate>
</AccordionItems>
</SfAccordion>
@code{
SfAccordion AcrdnObj;
public void SearchClicked()
{
AcrdnObj.ExpandItem(false, 0); // To dynamically expand or collapse the item based on the Boolean value and item index
}
public void CancelClicked()
{
AcrdnObj.ExpandItem(false, 0);
}
...
} |
Hi Richy,
Greetings from Syncfusion support!
We have checked your reported issue and you can programmatically collapse the Accordion items using EnableItem public method by passing specified item index and Boolean value. We have modified your shared code with below highlighted changes.
<SfAccordion @ref="AcrdnObj"></AccordionItems>...<div class="search-filter"><div class="search-box search-box-button"><SfButton Disabled="@IsBusy" @onclick="SearchClicked">Search</SfButton><SfButton @onclick="CancelClicked">Cancel</SfButton></div></div></div></ContentTemplate></AccordionItems></SfAccordion>@code{SfAccordion AcrdnObj;public void SearchClicked(){AcrdnObj.ExpandItem(false, 0); // To dynamically expand or collapse the item based on the Boolean value and item index}public void CancelClicked(){AcrdnObj.ExpandItem(false, 0);}...}
For the same, we have prepared a sample for your reference and same can be available in following link.Sample Link: https://www.syncfusion.com/downloads/support/directtrac/general/ze/Accordion-1628156831
Please get back to us, if you need further assistance.
RegardsAlagumeena.K
<SfTab>
<TabItems>
<TabItem>
<ChildContent>
<TabHeader Text="Paris"></TabHeader>
</ChildContent>
<ContentTemplate>
<SfAccordion @ref="AcrdnObj">
<AccordionItems>
...
<AccordionEvents Expanding="OnExpand"></AccordionEvents>
</SfAccordion>
</ContentTemplate>
</TabItem>
...
</TabItems>
</SfTab>
@code{
public void OnExpand(ExpandEventArgs args)
{
Console.WriteLine("Expanding event triggered");
}
...
} |