I would like to trigger an event handler when I single click on a cell in a specific row, then show a popup that uses data from other cells in that same row. That cell contains data and is not in a command column:
<GridColumn Field="@nameof(...)" HeaderText="..." AutoFit="true" />
The grid doesn't have a CellClick event. How do I accomplish this?
Hi Andy,
Thank you for reaching out to
us.
We understand that you are looking for a way to customize the selection of
cells in our Blazor DataGrid. We would like to suggest using the cell-selecting
and cell-selected events in our DataGrid. These events allow you to customize
the selection process and tailor it to your specific needs. Our documentation
provides detailed information on how to use these events, along with examples
and code snippets. You can find more information on these events here:
https://www.syncfusion.com/docs/blazor/datagrid/events#cellselecting
https://www.syncfusion.com/docs/blazor/datagrid/events#cellselected
Regards,
Prathap S
The CellSelecting and CellSelected events are not firing.
The links you sent me don't work. This is the proper link:
https://blazor.syncfusion.com/documentation/datagrid/events#cellselecting
<SfGrid DataSource="@roles" AllowSorting="true" AllowTextWrap="true" AllowFiltering="true" AllowSelection="false" Toolbar="@(new List<string>() { "Cancel", "Update" } )">
<GridEditSettings AllowAdding="false" AllowEditing="true" AllowDeleting="false" AllowEditOnDblClick="true" ShowDeleteConfirmDialog="true" />
<GridSelectionSettings Mode="Syncfusion.Blazor.Grids.SelectionMode.Cell" />
<GridSelectionSettings CheckboxOnly="false" />
<GridEvents QueryCellInfo="HandleRoleGridQueryCellInfo" TValue="Role" CommandClicked="HandleCommandClicked" OnBeginEdit="HandleBeginEdit" CellSelecting="HandleCellSelecting" />
<GridColumns>
<GridColumn Field="@nameof(Role.BaseRoleId)" IsPrimaryKey="true" HeaderText="BaseRole ID" Visible="false" />
<GridColumn Field="@nameof(Role.ApplicationId)" HeaderText="Application ID" Visible="false" />
<GridColumn Field="@nameof(Role.BaseRoleName)" HeaderText="App Role" AllowEditing="false" AutoFit="true" />
<GridColumn Field="@nameof(Role.IdentityProviderGroup)" HeaderText="Identity Provider Group" AutoFit="true" />
<GridColumn Field="@nameof(Role.CustomRoleIds)" HeaderText="Custom Role IDs" Visible="false" />
<GridColumn Field="@nameof(Role.CustomRoleNames)" HeaderText="Custom Roles" AutoFit="true" />
<GridColumn AutoFit="true">
<GridCommandColumns>
<GridCommandColumn Type="CommandButtonType.None" Title="abc" ButtonOption="@(new CommandButtonOptions(){IconCss="remove-image-icon-icon-image"})" />
</GridCommandColumns>
</GridColumn>
</GridColumns>
</SfGrid>
private void HandleCellSelecting(CellSelectingEventArgs<Role> args)
{
Console.WriteLine("");
}
Thank
you for bringing this to our attention. We apologize for any confusion caused
by the previous response. We understand that you are having difficulty with the normal editing type in DataGrid. To address this issue, we suggest using the
Cell Selected event and setting the AllowSelection property to true.
You can refer to the following documentation for more information:
https://blazor.syncfusion.com/documentation/datagrid/events#cellselected
Additionally, please note that the cell selecting event only triggers with batch
editing type. We have also provided a sample solution for your reference.