Grid
ConsoleMonster.Interactive
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
Usage
Explore 24 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 11
- Property DataGrid.Grid
- Property DataGridInputOptions.Grid
- Extension method Grid.OutputMode
- Extension method Grid.Presentation
- Extension method Grid.Title
- Method Grid.Column
- Method Grid.Row
- Method GridFluent.OutputMode
- Method GridFluent.Presentation
- Method GridFluent.Title
- Method Ui.Grid
Accepted by parameters 13
- Constructor DataGrid.DataGrid
- Extension method DataGrid.Grid
- Method DataGridFluent.Grid
- Extension method DataGridInputOptions.Grid
- Extension method DataGridInputOptions.Grid
- Method DataGridInputOptionsFluent.Grid
- Method DataGridInputOptionsFluent.Grid
- Extension method Grid.OutputMode
- Extension method Grid.Presentation
- Extension method Grid.Title
- Method GridFluent.OutputMode
- Method GridFluent.Presentation
- Method GridFluent.Title
Constructors
Methods
public Grid Column(TableColumn column) #Adds a column.
Parameters
- column ConsoleMonster.Widgets.TableColumn
- The column (header, presenter, alignment, priority).
public Grid Column(string header, ICellPresenter? presenter = null) #Adds a column by header.
Parameters
- header string
- The header.
- presenter ConsoleMonster.Presenters.ICellPresenter? = null
- The presenter, or null for automatic formatting.
public Grid Row(object? item, params object?[] values) #Adds a row: the object it stands for and its raw column values.
Parameters
- item object?
- The object returned when the row is chosen.
- values object?[]
- The column values (formatted by the column presenters).
public void SetRows(IEnumerable<GridRow> rows) #Replaces a listing. Reuse row identities to retain a DataGrid's cursor and marks.
Parameters
- rows System.Collections.Generic.IEnumerable<ConsoleMonster.Interactive.GridRow>
public GridResult Show(Action<GridOptions> configure, CancellationToken cancellationToken = default) #Shows this grid with freshly configured options.
Parameters
- configure System.Action<ConsoleMonster.Interactive.GridOptions>
- Grid settings.
- cancellationToken System.Threading.CancellationToken = default
- Cancellation.
public GridResult Show(GridOptions? options = null, CancellationToken cancellationToken = default) #Shows the grid and returns the chosen rows.
Parameters
- options ConsoleMonster.Interactive.GridOptions? = null
- The options, or null for the defaults.
- cancellationToken System.Threading.CancellationToken = default
- Cancels the grid.
public GridResult ShowInBrowser(GridOptions? options = null, BrowserGridOptions? browser = null, CancellationToken cancellationToken = default) #Shows the grid in the default browser and returns the chosen rows' original objects. The page is served from 127.0.0.1 on a random port behind a one-time token, loads nothing external, and offers the same filter, sort and selection as the screen grid. Commands and row refresh are screen-only. Lazy cells are computed before the page opens. Sessions where nobody can answer (InteractionMode.None or InteractionMode.Snapshot, a non-interactive flag, or CI) never open a browser.
Parameters
- options ConsoleMonster.Interactive.GridOptions? = null
- Filter, sort, hidden columns and interaction options; null for the defaults.
- browser ConsoleMonster.Interactive.BrowserGridOptions? = null
- How the page opens and how long to wait; null for the defaults.
- cancellationToken System.Threading.CancellationToken = default
- Stops waiting and closes the listener.
Returns
GridResult Accepted with the chosen items, or not accepted when the page was cancelled or closed.Exceptions
PromptUnavailableException– Nobody can answer in this session, or no browser could be opened.TimeoutException– The page did not answer within BrowserGridOptions.Timeout.
Inherited Methods
Properties
public GridSelection OutputMode { get; set; } #What the grid returns (default GridSelection.Multiple).
public PresentationOptions Presentation { get; set; } #Culture and display options for the presenters.
Extension Methods
public static Grid OutputMode(Grid grid, GridSelection value) #Sets Grid.OutputMode: What the grid returns (default GridSelection.Multiple).
Parameters
- grid ConsoleMonster.Interactive.Grid
- The instance.
- value ConsoleMonster.Interactive.GridSelection
- The value.
Examples
// C# initializer or property // C# fluent
grid.OutputMode = value; Ui.Grid().OutputMode(value);public static Grid Presentation(Grid grid, PresentationOptions value) #Sets Grid.Presentation: Culture and display options for the presenters.
Parameters
- grid ConsoleMonster.Interactive.Grid
- The instance.
- value ConsoleMonster.Presenters.PresentationOptions
- The value.
Examples
// C# initializer or property // C# fluent
grid.Presentation = value; Ui.Grid().Presentation(value);public static Grid Presentation(Grid grid, Action<PresentationOptions> configure) #Configures Grid.Presentation in place (creating it when not set): Culture and display options for the presenters.
Parameters
- grid ConsoleMonster.Interactive.Grid
- The instance.
- configure System.Action<ConsoleMonster.Presenters.PresentationOptions>
- Configures the value.
public static Grid Title(Grid grid, string value) #Sets Grid.Title: The title.
Parameters
- grid ConsoleMonster.Interactive.Grid
- The instance.
- value string
- The value.
Examples
// C# initializer or property // C# fluent
grid.Title = value; Ui.Grid().Title(value);