RowSelected not firing
Hi
I have a problem where the RowSelected event does not fire when I click on a row in the Grid.
However when I click sort then the OnActionComplete does fire.
This is the Grid:
<SfGrid @ref="PeopleGrid" DataSource="@PeopleList" Height="800" Width="Auto" AllowSorting="true" SelectedRowIndex="@SelectedRow" AllowSelection="true" EnableHover="true">
<GridEvents OnActionComplete="RowSelectHandler2" RowSelected="RowSelectHandler" TValue="PersonModel"></GridEvents>
<GridPageSettings PageSize="5"></GridPageSettings>
<GridColumns>
<GridColumn Field=@nameof(PersonModel.FirstName) HeaderText="First Name" Width="64"></GridColumn>
<GridColumn Field=@nameof(PersonModel.LastName) HeaderText="Last Name" Width="64"></GridColumn>
<GridColumn Field=@nameof(PersonModel.Sex) HeaderText="Sex" Width="32"></GridColumn>
<GridColumn HeaderText="Civil Status" Width="64">
<Template>
@{
var person = (context as PersonModel);
if (person.CivilStatuses[0].Status == Status.Single)
{
<div>@person.CivilStatuses[0].Status.ToString()</div>
}
else
{
if (person.CivilStatuses[0].Name.Length == 0)
{
<div>@person.CivilStatuses[0].Status.ToString()</div>
}
else
{
<div>@person.CivilStatuses[0].Name</div>
}
}
}
</Template>
</GridColumn>
<GridColumn Field=@nameof(PersonModel.BirthDay) HeaderText="Birthday" EditType="EditType.DatePickerEdit" Format="d" Type="ColumnType.Date" Width="64"></GridColumn>
</GridColumns>
</SfGrid>
And the is the two functions being called: (Where RowSelectHandler2 is fired and RowSelectHandler is not)
public void RowSelectHandler2(ActionEventArgs<PersonModel> args)
{
SetSelectedPerson(SelectedRow + 1);
}
public void RowSelectHandler(RowSelectEventArgs<PersonModel> args)
{
SetSelectedPerson(SelectedRow + 1);
}
SIGN IN To post a reply.
1 Reply
1 reply marked as answer
VN
Vignesh Natarajan
Syncfusion Team
June 3, 2020 06:18 AM UTC
Hi Theodor,
Greetings from Syncfusion support.
Query: “I have a problem where the RowSelected event does not fire when I click on a row in the Grid.”
We have prepared a sample using your code example and latest version Syncfusion Nuget package (18.1.0.55). We are not able to reproduce the reported issue at our end. RowSelected event gets triggered on clicking a record in Grid. Kindly refer the below sample for your reference
If you are still facing the issue, kindly get back to us with following details.
- Share you Blazor application type (Client or Server Side)
- Are you facing any script error in browser console (Ctrl+F12). If yes share the screenshot of the issue.
- Share the details about the SetSelected method.
- Share your Syncfusion Nuget package.
- If possible try to reproduce the reported issue in provided sample and revert back to us.
Above requested details will be helpful for us to validate the reported issue at our end and provide details as soon as possible.
Regards,
Vignesh Natarajan
Marked as answer
SIGN IN To post a reply.