LiveTable
ConsoleMonster.Widgets
A table whose rows change while a live session runs: rows have stable keys and are added, updated, removed or cleared through a LiveTableHandle (thread-safe, through the update queue). The LiveTable.Table defines the columns, presenters and options; its column widths only grow (Table.StableWidths), so rows never jitter while values change. Optionally only the most recent LiveTable.MaxRows rows are kept, and rows can be kept sorted by a column. Live operations (Key = row key): add and update (Payload = the values; both insert or replace), remove, clear. A recording replays the tab-separated text form of the values.
Inheritance
- LiveWidget
- LiveTable
Usage
Explore 25 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 13
- Extension method LiveTable.Filter
- Extension method LiveTable.KeyProperty
- Extension method LiveTable.MaxRows
- Extension method LiveTable.SortColumn
- Extension method LiveTable.SortDescending
- Extension method LiveTable.Table
- Method LiveTable.Add
- Method LiveTableFluent.Filter
- Method LiveTableFluent.KeyProperty
- Method LiveTableFluent.MaxRows
- Method LiveTableFluent.SortColumn
- Method LiveTableFluent.SortDescending
- Method LiveTableFluent.Table
Accepted by parameters 12
- Extension method LiveTable.Filter
- Extension method LiveTable.KeyProperty
- Extension method LiveTable.MaxRows
- Extension method LiveTable.SortColumn
- Extension method LiveTable.SortDescending
- Extension method LiveTable.Table
- Method LiveTableFluent.Filter
- Method LiveTableFluent.KeyProperty
- Method LiveTableFluent.MaxRows
- Method LiveTableFluent.SortColumn
- Method LiveTableFluent.SortDescending
- Method LiveTableFluent.Table
Constructors
public LiveTable(Table table, string widgetId = "table") #Creates a live table.
Parameters
- table ConsoleMonster.Widgets.Table
- The table that defines the columns and options (its own rows are replaced).
- widgetId string = "table"
- The live name (default table).
Methods
public LiveTable Add(object inputObject, string? keyProperty = null, ShapeOptions? shape = null) #Adds or replaces one ordinary object row, preserving typed cell values.
Parameters
- inputObject object
- The record or dictionary.
- keyProperty string? = null
- An explicit key field, otherwise KeyProperty or the first column.
- shape ConsoleMonster.Values.ShapeOptions? = null
- Host member adapters; null uses ordinary C# data adapters.
public override void Apply(LiveEvent liveEvent) #Applies an event to the widget's state.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event.
public override string? Describe(LiveEvent liveEvent) #Returns a line describing the event for line-based outputs (Stream/Plain), or null when the event is not worth a line (for example a single counter increment). Called after ILiveTarget.Apply.
Parameters
- liveEvent ConsoleMonster.Live.LiveEvent
- The event that was applied.
Returns
string? A plain line or null.public LiveTableHandle Handle(ILiveDispatcher dispatcher) #A handle that changes rows through a dispatcher (a live session).
Parameters
- dispatcher ConsoleMonster.Live.ILiveDispatcher
- The dispatcher.
public override Size Measure(Constraints constraints, RenderContext context) #Returns the size the widget wants within the constraints.
Parameters
- constraints ConsoleMonster.Layout.Constraints
- The space offered.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public bool Remove(string key) #Removes a row directly (not thread-safe; use a handle while a session runs).
Parameters
- key string
- The row key.
Returns
bool Whether the row existed.public override void Render(Region region, RenderContext context) #Renders into a region. The region may be smaller or larger than the measured size.
Parameters
- region ConsoleMonster.Canvas.Region
- The target region.
- context ConsoleMonster.Canvas.RenderContext
- Profile, theme and glyphs.
public void Set(string key, params object?[] values) #Adds or replaces a row directly (not thread-safe; use a handle while a session runs).
Parameters
- key string
- The row key.
- values object?[]
- The values, one per column.
public static string TextOf(object?[] values) #The text form of row values that recordings keep (tab-separated plain text).
Parameters
- values object?[]
- The values.
Returns
string The text.Inherited Methods
Properties
public Table Table { get; } #The table that defines the columns, presenters and options.
public int MaxRows { get; set; } #Keeps only the most recently added rows (0, the default, keeps them all): a bounded "recent N" window.
public int? SortColumn { get; set; } #The column index to keep rows sorted by, or null (default) for insertion order.
public bool SortDescending { get; set; } #Whether LiveTable.SortColumn sorts from the largest value down.
public string Filter { get; set; } #Only show rows whose cell values contain each literal word before formatting, ignoring case. Empty restores the full table.
public IReadOnlyList<string> VisibleKeys { get; } #Currently matching row keys, in display order. Hidden rows remain available for updates.
public string? KeyProperty { get; set; } #The input field used as the row key; null uses the first column's key or header.
Inherited Properties
Extension Methods
public static LiveTable Filter(LiveTable liveTable, string value) #Sets LiveTable.Filter: Only show rows whose cell values contain each literal word before formatting, ignoring case. Empty restores the full table.
Parameters
- liveTable ConsoleMonster.Widgets.LiveTable
- The instance.
- value string
- The value.
Examples
// C# initializer or property // C# fluent
liveTable.Filter = value; liveTable.Filter(value);public static LiveTable KeyProperty(LiveTable liveTable, string? value) #Sets LiveTable.KeyProperty: The input field used as the row key; null uses the first column's key or header.
Parameters
- liveTable ConsoleMonster.Widgets.LiveTable
- The instance.
- value string?
- The value.
Examples
// C# initializer or property // C# fluent
liveTable.KeyProperty = value; liveTable.KeyProperty(value);public static LiveTable MaxRows(LiveTable liveTable, int value) #Sets LiveTable.MaxRows: Keeps only the most recently added rows (0, the default, keeps them all): a bounded "recent N" window.
Parameters
- liveTable ConsoleMonster.Widgets.LiveTable
- The instance.
- value int
- The value.
Examples
// C# initializer or property // C# fluent
liveTable.MaxRows = value; liveTable.MaxRows(value);public static LiveTable SortColumn(LiveTable liveTable, int? value) #Sets LiveTable.SortColumn: The column index to keep rows sorted by, or null (default) for insertion order.
Parameters
- liveTable ConsoleMonster.Widgets.LiveTable
- The instance.
- value int?
- The value.
Examples
// C# initializer or property // C# fluent
liveTable.SortColumn = value; liveTable.SortColumn(value);public static LiveTable SortDescending(LiveTable liveTable, bool value = true) #Sets LiveTable.SortDescending: Whether LiveTable.SortColumn sorts from the largest value down.
Parameters
- liveTable ConsoleMonster.Widgets.LiveTable
- The instance.
- value bool = true
- The value; true when omitted.
Examples
// C# initializer or property // C# fluent
liveTable.SortDescending = value; liveTable.SortDescending(value);public static LiveTable Table(LiveTable liveTable, Action<Table> configure) #Configures LiveTable.Table in place: The table that defines the columns, presenters and options.
Parameters
- liveTable ConsoleMonster.Widgets.LiveTable
- The instance.
- configure System.Action<ConsoleMonster.Widgets.Table>
- Configures the value.