ListView

Description

This component represents a list view in Blazor using the Gap.Blazor.ListView model. It supports multiple view modes, including a detailed view rendered through a dedicated WMListViewDetails component. The component is designed to handle dynamic data and column configurations, with full support for selection and check state tracking.

Usage

@using System.Collections.ObjectModel
@using Gap.Blazor
@using Gap.Blazor.Components
@using System.Dynamic
@namespace Gap.Blazor.Components

@if (@listViewModel.View == ListViewMode.Details)
{
    <WMListViewDetails model="@listViewModel"></WMListViewDetails>
}

Properties

  • listViewModel: Instance of the Gap.Blazor.ListView model.

  • items: An observable collection of ExpandoObject used to represent dynamic data rows.

  • telerikGrid: Reference to a Telerik Grid component (used internally in detailed views).

  • DataAdapter: Instance of ListViewDataAdapter used to adapt the model’s data for rendering.

Methods

  • OnInitialized(): Initializes the data adapter and subscribes to model events:

    • Columns.ColumnHeaderAdded

    • Columns.ColumnHeaderRemoved

    • SelectedItems.AfterClear, AfterAdd

    • SelectedIndices.AfterClear, AfterAdd

    • CheckedIndices.AfterAdd, AfterRemove

  • OnParametersSetAsync(): Placeholder for handling parameter updates (currently no logic).

  • Columns(): Returns the ColumnHeaderCollection from the model.

Dynamic Rendering

The component conditionally renders the detailed view using:

  • WMListViewDetails: A specialized component for rendering the Details view mode.

  • View Mode Check: Only renders if listViewModel.View == ListViewMode.Details.

Events

  • ColumnHeaderAdded / Removed

  • SelectedItems / SelectedIndices / CheckedIndices: Add and clear events

  • NotifyModelChanged: Triggered indirectly via event subscriptions

Last updated