Skip to main content
All docs
V24.1

DxTreeList.PageIndexChanged Event

Fires when the TreeList’s active page index changes.

Namespace: DevExpress.Blazor

Assembly: DevExpress.Blazor.v24.1.dll

NuGet Package: DevExpress.Blazor

Declaration

[Parameter]
public EventCallback<int> PageIndexChanged { get; set; }

Parameters

Type Description
Int32

A new PageIndex value.

Remarks

The PageIndexChanged event fires each time the PageIndex property value changes. The event is handled automatically when you use two-way data binding for the PageIndex property (@bind-PageIndex).

You can also handle this event to create a custom response to page index changes.

<DxTreeList Data="TreeListData"
            KeyFieldName="Id"
            ParentKeyFieldName="ParentId"
            PageSize="5"
            PageIndex="@TreeListPageIndex"
            PageIndexChanged="OnPageIndexChanged">
    <Columns>
        <DxTreeListDataColumn FieldName="Name" Caption="Task" />
        <DxTreeListDataColumn FieldName="EmployeeName" />
        <DxTreeListDataColumn FieldName="StartDate" />
        <DxTreeListDataColumn FieldName="DueDate" />
    </Columns>
</DxTreeList>

<div>@PageIndexInfo</div>

@code {
    List<EmployeeTask> TreeListData { get; set; }
    int TreeListPageIndex { get; set; }
    string PageIndexInfo { get; set; }

    protected override void OnInitialized() {
        TreeListData = EmployeeTaskService.GenerateData();
    }
    void OnPageIndexChanged(int newPageIndex) {
        TreeListPageIndex = newPageIndex;
        PageIndexInfo = "You switched to page " + (newPageIndex + 1);
    }
}

Blazor TreeList Page Index Changed

For more information about paging in the TreeList component, refer to the following topic: Paging in Blazor TreeList.

See Also