Hello,
I have a dropdown inside my grid edit dialog:
<SfDropDownList @bind-Value="@AddOrEditDto.MennyisegiEgyseg" TValue="OptionDto<int>" TItem="OptionDto<int>" Placeholder="Mennyiség egység" AllowFiltering="true" FloatLabelType="FloatLabelType.Always" Query="cbMEQuery">
<SfDataManager Url="api/me/options" CrossDomain="true" Adaptor="Adaptors.UrlAdaptor" Offline=true></SfDataManager>
<DropDownListEvents DataBound="@OnDropDownDataBound" TValue="OptionDto<int>" TItem="OptionDto<int>"></DropDownListEvents>
<DropDownListFieldSettings Text="Text" />
</SfDropDownList>
<SfButton CssClass="btn-form" IconCss="e-icons e-refresh" OnClick="@(async () => { cbMEQuery = new Query(); })"></SfButton>
private void OnDropDownDataBound(DataBoundEventArgs args)
{
// Here, you can customize your code.
DataBounded = true;
}
public bool DataBounded { get; set; } = false;
The problem is that the DataBound event never firing. Thanks for help!
Hi SZL,
We are currently validating your requirement and we will update further details in two business day (4/19/2022).
Regards,
Mohanraj M
Hi SZL,
Greetings from Syncfusion support.
We suggest you to use OnActionComplete event instead of DataBound event. This event triggers after data is fetched successfully.
Documentation : https://blazor.syncfusion.com/documentation/dropdown-list/events#onactioncomplete
We have also attached sample code for your reference.
<SfDropDownList TItem="GameFields" TValue="string" DataSource="@Games"> <DropDownListEvents TItem="GameFields" TValue="string" OnActionComplete="@OnActionCompletehandler"></DropDownListEvents> <DropDownListFieldSettings Text="Text" Value="ID"></DropDownListFieldSettings> </SfDropDownList>
@code { public class GameFields { public string ID { get; set; } public string Text { get; set; } }
private List<GameFields> Games = new List<GameFields>() { new GameFields(){ ID= "Game1", Text= "American Football" }, new GameFields(){ ID= "Game2", Text= "Badminton" }, new GameFields(){ ID= "Game3", Text= "Basketball" }, new GameFields(){ ID= "Game4", Text= "Cricket" }, };
private void OnActionCompletehandler() { // Here, you can customize your code. } } |
Regards,
Mohanraj M
Hi,
Thank you, this will be perfect I think.
I have only one problem:
When I set the OnActionBegin and OnActionComplete events, after click on the refresh button at runtime the application and the browser freezing. This button uses the Query parameter to refresh the dropdown datasource.
When I remove the two event handler the refresh button works again.
Can you help me please what cause this behavior?
I attach my code again:
<SfDropDownList @bind-Value="@AddOrEditDto.MennyisegiEgyseg" TValue="OptionDto<int>" TItem="OptionDto<int>" TabIndex="9" Placeholder="Mennyiség egység" AllowFiltering="true" FloatLabelType="FloatLabelType.Always" Query="cbMEQuery">
<SfDataManager Url="api/mennyisegiegyseg/options" CrossDomain="true" Adaptor="Adaptors.UrlAdaptor" Offline=true></SfDataManager>
<DropDownListEvents OnActionBegin="@OnActionBeginHandler" OnActionComplete="@OnActionCompletehandler" TValue="OptionDto<int>" TItem="OptionDto<int>"></DropDownListEvents>
<DropDownListFieldSettings Text="Text" />
</SfDropDownList>
// Refresh button:
<SfButton Type="button" CssClass="btn-form" IconCss="e-icons e-refresh" OnClick="@(async () => { cbMEQuery = new Query(); })"></SfButton>
private void OnActionBeginHandler(ActionBeginEventArgs args)
{
// Here, you can customize your code.
DataBounded = false;
}
private void OnActionCompletehandler(ActionCompleteEventArgs<OptionDto<int>> args)
{
// Here, you can customize your code.
DataBounded = true;
}
public bool DataBounded { get; set; } = true;
protected Query cbMEQuery { get; set; }
I have some additional information: the OnActionBegin event handler causes the problem, with only the OnActionCompleted event handler working.
Based on your shared information, we have validated your reported requirement from our end. We will update you with further details in one business day (April 22nd,2022).
Thanks for your shared information. We have confirmed the reported issue is an issue at our end and this fix will be included in our upcoming patch release, which is expected to be rolled out on May 17th,2022.
You can track the status of this issue from the below feedback.
Feedback: https://www.syncfusion.com/feedback/34457
Disclaimer: Inclusion of this solution in the weekly release may change due to other factors including but not limited to QA checks and works reprioritization
SZL,
Thanks for your update.
Regards,
Sureshkumar P
We are facing complexity to resolve this issue. We will include it in the upcoming weekly patch release.
Which is expected to be rolled out on May 31st, 2022.
Hi SZL,
We are glad to announce that the fix for the reported issue has been implemented in the weekly patch release 20.1.57. We request you to update the NuGet to the latest version to get rid of this issue.
Find the release notes here: https://blazor.syncfusion.com/documentation/release-notes/20.1.57?type=all#dropdownlist
Regards,
Sureshkumar P
Hy,
Thank you, I tested it, it seems good.
Thanks for help!
BR, SZL
SZL,
Thanks for your update.
Regards,
Sureshkumar P