Accordion - programatically expand/collapse

Hi!

I've read the 2 questions/answers, but it doesn't work for me.

<SfAccordion @ref="AccordionObj">
. . .
@code{
AccordionObj.ExpandItem(false, 0)   
<<< SfAccordion does not contain a definition for 'ExpandItem'...
}

Can anyone help me?

Thanks

Attila


7 Replies

SK Satheesh Kumar Balasubramanian Syncfusion Team February 14, 2022 12:35 PM UTC

Hi Attila, 
  
We let you know that have already deprecated the ExpandItem method in our source. So, we have removed the deprecated method and properties in our source. We suggest you to use Two-way binding of Expanded property to expand and collapse programmatically. 
  
  
Index.razor: 
<SfButton @onclick="ChangePanel" Content="Change Panel"></SfButton> 
<SfAccordion> 
    <AccordionItems> 
        <AccordionItem @bind-Expanded="IsExpanded" Header="Margeret Peacock" Content="Margeret Peacock was born on Saturday , 01 December 1990. Now lives at Coventry House Miner Rd., London,UK. Margeret Peacock holds a position of Sales Coordinator in our WA department, (Seattle USA). Joined our company on Saturday , 01 May 2010"></AccordionItem> 
</SfAccordion> 
@code{ 
    bool IsExpanded = true; 
    private void ChangePanel() 
    { 
        IsExpanded = !IsExpanded; 
    } 
  
Kindly try the above sample and let us know if this meets your requirement. 
  
Regards, 
Satheesh Kumar B 




AL Attila László February 16, 2022 12:57 AM UTC

Hi!


This works well.

Thank you.


------------------------------------------------------------------------------------------

I have another problem (if I may).

<SfTextBox CssClass="e-outline" @onkeypress="KeyPress" @bind-Value="@selectedId" @oninput="@((e) => {selectedId=(string)e.Value;})"></SfTextBox>

This works very strange way.

When the oninput put the actual value to the selectedId variable, sometimes it is deletes back the last part (the end) of the text in the textbox. So it looks like it is blinking or jumping forward/backward. If I press a button long, it is more  conspicuous way. Try it, you would lokk that.


Microsoft:  <input @bind="inputValue" @bind:event="oninput">

This works fine. Because oninput does nothing, just renders the component (I think).


Can you help me?


Attila



PM Ponmani Murugaiyan Syncfusion Team February 17, 2022 01:16 PM UTC

Hi Attila, 

Query: Sometimes it is deletes back the last part (the end) of the text in the textbox. So it looks like it is blinking or jumping forward/backward. 
 
We have prepared sample based on your code snippet and ensured your reported issue. But unfortunately we couldn’t replicate in our end, please find the attached sample and output below for reference. 

Also, we would like to suggest you the Input event of the TextBox component. 

@using Syncfusion.Blazor.Inputs 
 
<p>Value: @selectedId</p> 
 
<SfTextBox CssClass="e-outline" @onkeypress="KeyPressed" @bind-Value="@selectedId" @oninput="@((e) => {selectedId=(string)e.Value;})"></SfTextBox> 
@code { 
    public string selectedId { get; set; } 
 
    public void KeyPressed(KeyboardEventArgs args) 
    { 
         
    } 
} 

 

Kindly check with the above sample and if issue still exists in your end, share the below details. 

  1. Issue reproducing video demonstration.
  2. Whether the issue occurs in local or azure.
  3. If possible share issue reproducing sample.

Regards, 
Ponmani M 



AL Attila László February 17, 2022 10:17 PM UTC

Hi!

I realized, I don't need to bind input value.

Therefore I use Input="@InputHandler".

Thank you for your help.

Attila



PM Ponmani Murugaiyan Syncfusion Team February 18, 2022 04:25 AM UTC

Hi Attila, 

Welcome, we are glad to hear that the issue has been resolved. 

Regards, 
Ponmani M 



JD Jimmy De La Garza December 20, 2024 03:30 AM UTC

How would you go about expanding a set of accordions? for example, 


@foreach( ... )
{
   <SfAccordion>  
      @foreach ( ... ) //For the items
   </SfAccordion>
}

    




YS Yohapuja Selvakumaran Syncfusion Team December 23, 2024 09:51 AM UTC

Hi Jimmy De La Garza,

We have validated and branched this accordiaon query to a separate forum. You can track the progress and receive updates by following the ticket link provided below:


Forum: How to expanding a set of accordions? - from 172828 | Blazor Forums | Syncfusion


Regards,

Yohapuja S


Loader.
Up arrow icon