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.ListViewmodel.items: An observable collection of
ExpandoObjectused to represent dynamic data rows.telerikGrid: Reference to a Telerik
Gridcomponent (used internally in detailed views).DataAdapter: Instance of
ListViewDataAdapterused to adapt the model’s data for rendering.
Methods
OnInitialized(): Initializes the data adapter and subscribes to model events:
Columns.ColumnHeaderAddedColumns.ColumnHeaderRemovedSelectedItems.AfterClear,AfterAddSelectedIndices.AfterClear,AfterAddCheckedIndices.AfterAdd,AfterRemove
OnParametersSetAsync(): Placeholder for handling parameter updates (currently no logic).
Columns(): Returns the
ColumnHeaderCollectionfrom the model.
Dynamic Rendering
The component conditionally renders the detailed view using:
WMListViewDetails: A specialized component for rendering the
Detailsview 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