Skip to main content

LgListView<TItem>

Module : Lagoon.UI
Namespace : Lagoon.UI.Components
Category: ListView
Inherits from: LgAriaComponentBase

List view component.

Parameters​

ParameterTypeDescription
ActiveItemTItemGets or sets the active item (two-way binding): its card gets the active class. When bound, a click on a card makes its item active. The items are compared like the selection (see KeyField).
ActiveItemChangedEventCallback<TItem>Gets or sets the event raised when the active item changes (two-way binding of ActiveItem).
AdditionalAttributesIReadOnlyDictionary<string, object>Gets or sets a collection of additional attributes that will be applied to the created element.
AllowCancellationboolGets or sets a value indicating whether the user can cancel the remote data loading.
AllowPagingboolGets or sets a value indicating whether the items are paginated.
BodyContentRenderFragment<TItem>Gets or sets the content of the card body (ListViewItemContext{TItem}.RenderBody). The card body displays item.ToString() when it is not set.
CanDropFunc<ListViewDropContext<TItem>, bool>Gets or sets the method indicating if a dragged item can be dropped at a position of this list (target list), called while the item is hovering the position. A refused position displays no insertion line and the item cannot be released there.
CollapsableboolGets or sets a value indicating whether the list can be collapsed by a click on its header.
CollapsedboolGets or sets a value indicating whether the list is collapsed (two-way binding).
CollapsedChangedEventCallback<bool>Gets or sets the event raised when the list is collapsed or expanded (two-way binding of Collapsed).
ColorSelectorFunc<TItem, string>Gets or sets the method returning the CSS color of the stripe of an item's card (ListViewItemContext{TItem}.Color). The stripe is displayed when this method, StripeCssClassSelector or StripeIconSelector returns a value, or when StripeContent is set; without color nor stripe CSS class, it keeps the theme color.
ConfirmationMessageSelectorFunc<TItem, string>Gets or sets the method returning the message to confirm before the action of a click on an item's card (OnItemClick, active item or link). No confirmation is asked when it returns null or an empty string.
ControllerQueryArgobjectGets or sets the additional argument to send to the controller with each data query.
ControllerUristringGets or sets the URI of the controller providing the items. When set, the data is loaded remotely from the "[Queryable]" endpoint instead of the Items list.
CssClassstringGets or sets the CSS classes.
CssClassSelectorFunc<TItem, string>Gets or sets the method returning the CSS classes added to an item's default card (ListViewItemContext{TItem}.CssClass in an ItemTemplate).
CurrentPageintGets or sets the current page index (1 for the first page).
CurrentPageChangedEventCallback<int>Gets or sets the event raised when the current page changes.
DataErrorTitlestringGets or sets the title displayed when the data loading fails.
DefaultCollapsedbool?Gets or sets the initial collapsed state. When defined, it overrides the initial value of Collapsed.
DefaultGroupCollapsedboolGets or sets if the groups are initially collapsed. (Default is false)
DefaultPageSizeint?Gets or sets the initial page size. Must be one of the PaginationSizeSelector values (0 = all the items, when offered by the selector); the first value of the selector otherwise.
DefaultShowFiltersbool?Gets or sets a value indicating whether the filter panel is initially visible. When defined, it overrides the initial value of ShowFilters.
DisplayInputPageSelectorboolGets or sets a value indicating whether the pager displays a numeric input to go to a page.
DragFromItemboolGets or sets if the mouse (or the pen) drags an item from anywhere on it, and not only from its drag handle (DragMode): a press without move still clicks the item, and its fields and controls (links, buttons, inputs, elements with the button role) do not start a drag. The touch keeps the long press on the item and the keyboard keeps the handle. (Default is false)
DragGroupstringGets or sets the name of the group of lists exchanging items (ListViewDragMode.DragOut and ListViewDragMode.DropIn): an item can only be dropped into a list of the same group, with the same item type. Without group, the items can only be reordered inside the list.
DragModeListViewDragModeGets or sets the drag and drop capabilities of the list (flags). The items are dragged by a handle displayed on the left of their card (or rendered by ListViewItemContext{TItem}.RenderDragHandle in a custom template), with the mouse, the touch or the keyboard. (Default is ListViewDragMode.None)
FiltersRenderFragmentGets or sets the filter declarations (a list of LgListViewFilter{TItem, TValue} components), rendered in a collapsible panel above the list.
FiltersPositionListViewFiltersPositionGets or sets the position of the filter panel: above the items, in a centered modal window or in a drawer sliding from the left or the right edge of the screen. (Default is ListViewFiltersPosition.Top)
GroupCollapsableboolGets or sets if the user can collapse and expand the groups (group header click, "Expand all" / "Collapse all" buttons). When false, the groups are always expanded and DefaultGroupCollapsed is ignored. (Default is true)
GroupColorSelectorFunc<TItem, string>Gets or sets the method returning the CSS color of the stripe of a group header, called with the first item of the group. No stripe is displayed when it returns null or an empty string.
GroupHeaderContentRenderFragment<ListViewGroupContext<TItem>>Gets or sets the content of a group header. The header displays the group key (ListViewGroupContext{TItem}.Text) and the number of items of the group when it is not set.
GroupOrderSelectorExpression<Func<TItem, object>>Gets or sets the order of the groups (e.g. the rank of a status grouped by its label). The groups are sorted by key when it is not set. Ignored without GroupSelector.
GroupSelectorExpression<Func<TItem, object>>Gets or sets the group key of an item. When set, the displayed items are grouped by key under a collapsible group header: the list is sorted by group first (by GroupOrderSelector, then by key), then by the selected sort, also on the server side with ControllerUri. With AllowPaging, the groups are those of the current page.
IconNamestringGets or sets the name of the icon displayed before the title.
ItemCopyFactoryFunc<TItem, TItem>Gets or sets the method creating the copy of an item dragged from this list into another one, with ListViewDragMode.Copy (the item itself is inserted into the target list when it is not set).
ItemMinWidthstringGets or sets the minimal width of an item (CSS length, e.g. "18rem"). When set, the items are laid out in a grid filling the available width with as many columns as possible. Ignored when Virtualize is enabled.
ItemTemplateRenderFragment<ListViewItemContext<TItem>>Get or sets the item template (card for example). When set, it controls the whole item rendering; its ListViewItemContext{TItem} exposes the item and the parts of the default card (ListViewItemContext{TItem}.RenderCard, ListViewItemContext{TItem}.RenderStripe, ListViewItemContext{TItem}.RenderBody, ListViewItemContext{TItem}.CssClass) built from the card parameters (BodyContent, StripeContent, the selectors, OnItemClick, ActiveItem). When it is not set, a default card is rendered from these parameters.
ItemsICollection<TItem>Gets or sets the local items source. Ignored when ControllerUri is set.
KeyFieldstringGets or sets the name of the property identifying an item. Selected items are compared on this property, so the selection survives a reload of the items (e.g. a remote page change). When omitted, a remote list (ControllerUri) uses the Id property of the item type when it has one; otherwise, the default equality of the item type is used. The key follows a change of this parameter or of the data source (local / remote).
KindKindGets or sets the kind of the frame wrapping the list. (Default is Kind.Primary)
LinkSelectorFunc<TItem, LgPageLink>Gets or sets the method returning the page opened by a click on an item's card (LgCard.Link). An item with a link navigates without raising OnItemClick nor changing the active item.
ListViewDataCounterListViewDataCounterGets or sets the counters of the loaded data (two-way binding, updated after each data load).
ListViewDataCounterChangedEventCallback<ListViewDataCounter>Gets or sets the event raised when the data counters change (two-way binding of ListViewDataCounter).
NoDataDescriptionstringGets or sets the description displayed when the data source contains no item.
NoDataTitlestringGets or sets the title displayed when the data source contains no item.
OnFilterChangedEventCallback<ListViewFilterChangedEventArgs>Gets or sets the event raised when the set of active filters changes (including when the filter values are restored from the persisted state).
OnItemClickEventCallback<TItem>Gets or sets the event raised when an item's card is clicked. When set, the cards are clickable. The click first makes the item active when ActiveItem is bound. It is not raised for an item with a link (LinkSelector): the card navigates instead.
OnItemDropEventCallback<ListViewDropEventArgs<TItem>>Gets or sets the event raised on this list (target list) when an item is released on an accepted position, before the items are updated: set ListViewDropEventArgs{TItem}.Cancel to refuse the drop, or ListViewDropEventArgs{TItem}.Handled when the handler updated the items itself. Required to drop an item into another group of a grouped list (the handler updates the grouped property of the item).
OnItemDroppedEventCallback<ListViewDropEventArgs<TItem>>Gets or sets the event raised on this list (target list) once a dropped item is in place: the items are updated and the lists refreshed (e.g. to save the new order).
OnRowSelectionEventCallback<ListViewSelectionEventArgs<TItem>>Gets or sets the event raised when the selection changes.
OnSortChangedEventCallback<ListViewSortEventArgs>Gets or sets the event raised when the sort property or the sort direction changes.
PagerOnTopboolGets or sets a value indicating whether the pager is displayed above the items instead of below.
PaginationButtonCountintGets or sets the number of page buttons displayed by the pager.
PaginationSizeSelectorint[]Gets or sets the available page sizes. Use the value 0 to offer the "all items" choice.
SelectableRowsboolGets or sets a value indicating whether the items are selectable (a checkbox is displayed in front of each item). (Default is false)
SelectionICollection<TItem>Gets or sets the list of selected items. A new list is created when omitted.
ShowFiltersboolGets or sets a value indicating whether the filter panel is visible (two-way binding). Hiding the panel keeps the filter values.
ShowFiltersChangedEventCallback<bool>Gets or sets the event raised when the filter panel visibility changes (two-way binding of ShowFilters).
ShowFiltersSummaryboolGets or sets a value indicating whether the active filters are summed up under the title ("Name : value"), like the grid filters summary, while the filter panel is hidden. (Default is false)
SortOptionsRenderFragmentGets or set the sortable field declarations (a list of LgListViewSort{TItem} components). The initial sort is the declaration with IsDefault="true"; the list is not sorted initially when there is none.
StateIdstringGets or sets the identifier used to persist the list state (sort, page size, filter values, filter panel visibility) in the browser local storage. The state is not persisted when omitted.
StripeContentRenderFragment<TItem>Gets or sets the content rendered inside the stripe of the card (ListViewItemContext{TItem}.RenderStripe). When it is set, every item has a stripe, of the theme color unless ColorSelector or StripeCssClassSelector returns a value.
StripeCssClassSelectorFunc<TItem, string>Gets or sets the method returning the CSS classes of the stripe of an item's card (a theme class setting its color for example). The stripe is displayed when this method, ColorSelector or StripeIconSelector returns a value, or when StripeContent is set.
StripeIconSelectorFunc<TItem, string>Gets or sets the method returning the name of the icon displayed in the stripe of an item's card. An icon displays the stripe, of the theme color unless ColorSelector or StripeCssClassSelector returns a value.
TitlestringGets or sets the view title. The counters of the last loaded data, like in the grid title, replace {0} (total number of items) and {1} (number of items of the page); a counter is displayed as ... while unknown (before the first load, and for {1} when the page is empty).
TitleContentRenderFragmentGets or sets the content rendered after the title in the frame header.
ToolbarRenderFragmentGets or sets the toolbar (top)
ToolbarSelectionRenderFragmentGets or sets the selection toolbar (bottom)
TooltipIsHtmlboolGets or sets if the tooltips returned by TooltipSelector use the HTML format; else, they use a raw text format. (Default is false)
TooltipSelectorFunc<TItem, string>Gets or sets the method returning the tooltip of an item's card.
VirtualizeboolGets or sets a value indicating whether the rendering of the items is virtualized (only the visible items are rendered). With AllowPaging, the items of the current page are virtualized.
VirtualizeItemSizefloatGets or sets the expected height, in pixels, of an item when the rendering is virtualized.

Parameters inherited from LgAriaComponentBase​

ParameterTypeDescription
AriaLabelstringGets or sets aria label
AriaLabelledBystringGets or sets id of component for aria label