SelectionChanged Event not firing
Here is my code:
<SfComboBox TValue="int?" TItem="VwActiveMatter" SelectionChanged="onChange"
Width="300px"
@bind-Value="@calendaritem.MatterId"
DataSource="@MattersList"
Placeholder="---Please Select a Matter---" AllowFiltering=true>
<ComboBoxFieldSettings Text="CaseNumber" Value="MatterId"></ComboBoxFieldSettings>
</SfComboBox>
private void onChange(Syncfusion.Blazor.DropDowns.ChangeEventArgs<int, VwActiveMatter> args)
{
int intMatterId = args.Value; // Int32.Parse(args.Value.ToString());
matter = MatterService.GetMatter(intMatterId,true);
Attendees = AttendeesList();
NamesList = GetNamesList();
//InvokeAsync(StateHasChanged);
StateHasChanged();
}
But this event never fires. Why?
TIA,
Miles
SIGN IN To post a reply.
1 Reply
1 reply marked as answer
PM
Ponmani Murugaiyan
Syncfusion Team
May 25, 2021 07:29 AM UTC
Hi Miles,
Thanks for contacting Syncfusion support.
As per your provided code snippet, you have binded the SelectionChanged event, but we didn’t have SelectionChanged event in ComboBox component. Also, in order to bind the events, we have a separate tag called ComboBoxEvents, in which you can bind the desired events as per your requirement. Please find the list of events provided for ComboBox component in the below link.
ComboBox Events: https://help.syncfusion.com/cr/blazor/Syncfusion.Blazor.DropDowns.ComboBoxEvents-2.html#properties
As per your requirement the below two events are triggered when the item in a popup are selected by the user. For more information, please check with the events description in the below link:
|
<SfComboBox TValue="int?" TItem="VwActiveMatter" Width="300px" @bind-Value="@ComboVal" DataSource="@MattersList" Placeholder="---Please Select a Matter---" AllowFiltering=true>
<ComboBoxFieldSettings Value="MatterId" Text="CaseNumber"></ComboBoxFieldSettings>
<ComboBoxEvents TValue="int?" TItem="VwActiveMatter" OnValueSelect="ValueSelect" ValueChange="OnValueChange"></ComboBoxEvents>
</SfComboBox>
@code {
public int? ComboVal { get; set; }
public class VwActiveMatter
{
public int MatterId { get; set; }
public string CaseNumber { get; set; }
}
List<VwActiveMatter> MattersList = new List<VwActiveMatter> {
new VwActiveMatter() { MatterId= 1, CaseNumber= "12345" },
new VwActiveMatter() { MatterId= 2, CaseNumber= "6789" },
new VwActiveMatter() { MatterId= 3, CaseNumber= "2312" },
new VwActiveMatter() { MatterId= 4, CaseNumber= "3453" },
new VwActiveMatter() { MatterId= 5, CaseNumber= "5657" },
};
public void ValueSelect(SelectEventArgs<VwActiveMatter> args)
{
//Triggers when an item in the popup is selected by the user either with mouse / tap or with keyboard navigation.
}
public void OnValueChange(ChangeEventArgs<int?, VwActiveMatter> args)
{
//Triggers when an item in a popup is selected or when the model value is changed by user.
}
} |
Based on the above shared information, we request you to modify to meet your requirement. Please get back us if you need further assistance.
Regards,
Ponmani M
Marked as answer
SIGN IN To post a reply.
- 1 Reply
- 2 Participants
- Marked answer
-
MG Miles Gibson
- May 24, 2021 09:14 PM UTC
- May 25, 2021 07:29 AM UTC