LgGridSelectColumn
LgGridSelectColumn<TColumnValue, TDataSourceItem> binds a value to a list-type data source for display, editing, and filtering.
<Columns Context="item">
<LgGridSelectColumn @bind-Value="item.StatusId"
Title="#Status"
DataSource="_statusDataSource" />
</Columns>
- NuGet Package:
Lagoon.UI.GridView
Common parameters are documented in LgGridBaseColumn.
Usage
Demo
Try this component in the Lagoon showcase.
Simple selection list
GridSelectColumnPage.razor
@inherits LgPage
<LgGridView StateId="orders-select-column"
Items="_orders"
EditMode="GridEditMode.Cell"
Exportable="true"
Title="#OrdersGridTitle">
<Columns Context="item">
<LgGridTextColumn @bind-Value="item.Number" Title="#OrderNumber" />
<LgGridSelectColumn @bind-Value="item.StatusId"
Title="#Status"
DataSource="_statusDataSource"
ExportFormat="ExportSelectFormat.Text"
ResetButton="true" />
</Columns>
</LgGridView>
GridSelectColumnPage.razor.cs
public partial class GridSelectColumnPage : LgPage
{
// Source de choix partagée par la colonne et son filtre multi-sélection.
private readonly StatusDataSource _statusDataSource = new(new List<StatusItem>
{
new() { Id = 1, Label = "#Draft" },
new() { Id = 2, Label = "#Validated" },
});
}
public sealed class StatusDataSource : ListDataSource<StatusItem, int>
{
public StatusDataSource(List<StatusItem> items) : base(items)
{ }
// Texte affiché dans la cellule, la liste d'édition et le filtre.
public override string GetItemText(StatusItem item)
{
return item.Label;
}
// Valeur stockée dans le modèle de ligne.
public override int GetItemValue(StatusItem item)
{
return item.Id;
}
}
public sealed class StatusItem
{
public int Id { get; set; }
public string Label { get; set; }
}
Filter
Simple selection filter.
Associated Enumerations
ExportSelectFormat
Export format for selection elements (property ExportFormat).
| Value | Description |
|---|---|
Text | Exports the displayed text of the element (default value of export configuration). |
Value | Exports the value of the element. |
Inherited edit modes (GridEditMode) are documented in LgGridView.
Complete Reference
Sheet generated from sources: API Reference — LgGridSelectColumn.
Related Components
LgGridView— the data grid that hosts the column.LgGridTextColumn— base column and inherited common parameters.LgGridSelectMultipleColumn— multi-value variant.LgGridEnumColumn— selection of an enumeration value.