Skip to main content
All docs
V24.1

DxTreeList.RowClick Event

Fires when a user clicks or taps a TreeList row or focuses a data cell and presses Enter.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public EventCallback<TreeListRowClickEventArgs> RowClick { get; set; }

Parameters

Type Description
TreeListRowClickEventArgs

The event data.

Remarks

The TreeList component raises the RowClick event in response to the following actions:

  • A user clicks a data row with a pointing device.
  • A user focuses a data cell in display mode and presses Enter.

The InputDevice event argument determines which action triggered the event. Use Column and VisibleIndex arguments to determine the position of the processed cell. The TreeList argument allows you to access the TreeList and its extensive API.

The following code snippet displays the following information about the clicked row:

  • The row’s visible index
  • The task name that corresponds to the row
@inject EmployeeTaskService EmployeeTaskService

<DxTreeList Data="TreeListData" KeyFieldName="Id" ParentKeyFieldName="ParentId" RowClick="OnRowClick">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
    </Columns>
</DxTreeList>

@Alert

@code {
    List<EmployeeTask> TreeListData { get; set; }
    public string Alert { get; set; } = "";

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
    void OnRowClick(TreeListRowClickEventArgs e) {
        Alert = $"Clicked row index: {e.VisibleIndex}. Corresponding task: '{e.TreeList.GetRowValue(e.VisibleIndex, "Name")}'";
    }
}

TreeList - Row Click

You can enable the AllowSelectRowByClick property to allow users to select rows by mouse clicks, tap gestures, and keyboard shortcuts. Shift+Click selects a range of rows. Ctrl+Click toggles the selected state for an individual row. When you handle the RowClick event, use ShiftKey and CtrlKey arguments to determine whether the user held down the Shift or Ctrl key.

Limitations

The RowClick event does not fire in the following cases:

  • A user focuses a data cell that contains nested focusable objects (links, buttons, editors, etc.) and presses Enter.
  • A user clicks or taps expand and collapse buttons or focuses them and presses Enter.
  • A user clicks or taps a space to the right of the TreeList component. This space appears when the total width of all columns is less than the component’s width.
See Also