Skip to content
ConsoleMonster

API Reference

Class

Grid (Interactive)

Namespace ConsoleMonster.Interactive
Assembly ConsoleMonster
Source Grid.cs:26
Modifiers sealed

An interactive table viewer: filter as you type, sort by column, page and scroll, mark rows, choose columns, and see a row's details. It returns the original objects of the chosen rows. Columns use the table's width negotiation and presenters; the screen has the same header bar, panel and footer as menus and forms.

Inheritance

  • Object
  • Grid

Constructors

public Grid(String title) #

Creates a grid.

Parameters

title System.String requiredposition: 0
The title in the header bar.

Methods

AddColumn 2 overloads
public Grid AddColumn(TableColumn column) #
Returns: Grid

Adds a column.

Parameters

column ConsoleMonster.Widgets.TableColumn requiredposition: 0
The column (header, presenter, alignment, priority).

Returns

The grid.

public Grid AddColumn(String header, ICellPresenter? presenter = null) #
Returns: Grid

Adds a column by header.

Parameters

header System.String requiredposition: 0
The header.
presenter ConsoleMonster.Presenters.ICellPresenter? = null optionalposition: 1
The presenter, or null for automatic formatting.

Returns

The grid.

public Grid AddRow(Object? item, params Object?[] values) #
Returns: Grid

Adds a row: the object it stands for and its raw column values.

Parameters

item System.Object? requiredposition: 0
The object returned when the row is chosen.
values System.Object?[] requiredposition: 1
The column values (formatted by the column presenters).

Returns

The grid.

public GridResult Show(GridOptions? options = null, CancellationToken cancellationToken = default) #
Returns: GridResult

Shows the grid and returns the chosen rows.

Parameters

options ConsoleMonster.Interactive.GridOptions? = null optionalposition: 0
The options, or null for the defaults.
cancellationToken System.Threading.CancellationToken = default optionalposition: 1
Cancels the grid.

Returns

The result.

Properties

public String Title { get; set; } #

The title.

public GridSelection Selection { get; set; } #

What the grid returns (default GridSelection.Multiple).

public PresentationOptions Presentation { get; set; } #

Culture and display options for the presenters.

public IReadOnlyList<TableColumn> Columns { get; } #

The columns.

public IReadOnlyList<GridRow> Rows { get; } #

The rows.