|
@using Syncfusion.EJ2.Blazor.Navigations
<EjsAccordion @ref="AcrdnObj" DataSource="@CourseProgressData" ModelType="@typeof(CourseProgressItem)">
<AccordionEvents Created="OnCreated"></AccordionEvents>
<AccordionTemplates>
<HeaderTemplate>
@{
var data = (context as CourseProgressItem);
<div>@data.Id</div>
}
</HeaderTemplate>
<ItemTemplate>
@{
var data = (context as CourseProgressItem);
<div>@data.Name</div>
}
</ItemTemplate>
</AccordionTemplates>
</EjsAccordion>
@code{
EjsAccordion AcrdnObj;
public class CourseProgressItem
{
public int Id { get; set; }
public string Name { get; set; }
}
public List<CourseProgressItem> CourseProgressData = new List<CourseProgressItem>();
public async Task<List<CourseProgressItem>> GetCourseProgress()
{
CourseProgressData.Add(new CourseProgressItem { Id = 1, Name = "Item1" });
CourseProgressData.Add(new CourseProgressItem { Id = 2, Name = "Item2" });
return CourseProgressData;
}
protected override async Task OnInitializedAsync()
{
var data = await GetCourseProgress();
CourseProgressData = data;
}
public async void OnCreated()
{
await Task.Delay(150);
await AcrdnObj.ExpandItem(true, 0); // To expand specified accordion item
}
} |
We are glad to announce that our latest release in the
version 18.2.0.44 has been rolled out successfully. In that release, we have
provided ExpandedIndices property has been introduced to expand accordion panel
especially when panels bind through DataSource.
So, we suggest you upgrade our Syncfusion packages to avail of the
requested feature in your end.
Please find the links below,
NuGet Link: https://www.nuget.org/packages/Syncfusion.Blazor/18.2.0.44
Release notes: https://blazor.syncfusion.com/documentation/release-notes/18.2.44/?type=all#accordion
Could you please check the above links and get back to us,
if you need any further assistance on this.
Regards,
Vengatesh