Class TableSelector
- Namespace
- ConsoleAppVisuals.InteractiveElements
- Assembly
- ConsoleAppVisuals.dll
The TableSelector is an interactive element that displays a table with selectable elements.
public class TableSelector : InteractiveElement<int>
- Inheritance
-
TableSelector
- Inherited Members
Remarks
For more information, consider visiting the documentation available here.
Constructors
TableSelector(string?, List<string>?, List<List<string>>?, bool, bool, string?, Placement, BordersType)
The TableSelector is an interactive element that displays a table with selectable elements.
public TableSelector(string? title = null, List<string>? headers = null, List<List<string>>? lines = null, bool excludeHeader = true, bool excludeFooter = true, string? footerText = null, Placement placement = Placement.TopCenter, BordersType bordersType = BordersType.SingleStraight)
Parameters
title
stringThe title of the table.
headers
List<string>The headers of the table.
lines
List<List<string>>The lines of the table.
excludeHeader
boolWhether to exclude the header from selectable elements.
excludeFooter
boolWhether to exclude the footer from selectable elements.
footerText
stringThe text to display in the footer.
placement
PlacementThe placement of the table.
bordersType
BordersTypeThe type of the borders of the table.
Remarks
For more information, consider visiting the documentation available here.
Exceptions
- ArgumentException
Thrown when the number of columns in the table is not consistent with itself or with the headers.
- NullReferenceException
Thrown when no body lines were provided.
Properties
Borders
Gets the borders manager of the table.
public Borders Borders { get; }
Property Value
BordersType
Gets the type of the borders of the table.
public BordersType BordersType { get; }
Property Value
Count
Gets the number of lines in the table.
public int Count { get; }
Property Value
DisplayArray
Gets the display array of the table.
public string[]? DisplayArray { get; }
Property Value
- string[]
ExcludeFooter
Gets if the footer is excluded.
public bool ExcludeFooter { get; }
Property Value
ExcludeHeader
Gets if the header is excluded.
public bool ExcludeHeader { get; }
Property Value
FooterText
Gets the text of the footer.
public string FooterText { get; }
Property Value
GetRawHeaders
Gets the headers of the table.
public List<string>? GetRawHeaders { get; }
Property Value
GetRawLines
Gets the lines of the table.
public List<List<string>>? GetRawLines { get; }
Property Value
Height
Gets the height of the table.
public override int Height { get; }
Property Value
Placement
Gets the placement of the table on the console.
public override Placement Placement { get; }
Property Value
Title
Gets the title of the table.
public string? Title { get; }
Property Value
Width
Gets the width of the table.
public override int Width { get; }
Property Value
Methods
AddHeaders(List<string>)
Adds headers to the table.
public void AddHeaders(List<string> headers)
Parameters
Remarks
For more information, consider visiting the documentation available here.
AddLine(List<string>)
Adds a line to the table.
public void AddLine(List<string> line)
Parameters
Remarks
For more information, consider visiting the documentation available here.
Exceptions
- ArgumentException
Thrown when the number of columns in the table is not consistent with itself or with the headers.
AddTitle(string)
Adds a title to the table.
public void AddTitle(string title)
Parameters
title
stringThe title to add.
Remarks
For more information, consider visiting the documentation available here.
ClearHeaders()
Clears the headers of the table.
public void ClearHeaders()
Remarks
For more information, consider visiting the documentation available here.
ClearLines()
Clears the lines of the table.
public void ClearLines()
Remarks
For more information, consider visiting the documentation available here.
GetColumnData(int)
Gets all the elements from a column given its index.
public List<string>? GetColumnData(int index)
Parameters
index
intThe index of the column.
Returns
Remarks
For more information, consider visiting the documentation available here.
Exceptions
- ArgumentOutOfRangeException
Thrown when the index is out of range.
GetColumnData(string)
Gets all the elements from a column given its header.
public List<string>? GetColumnData(string header)
Parameters
header
stringThe header of the column.
Returns
Remarks
For more information, consider visiting the documentation available here.
Exceptions
- ArgumentException
Thrown when the header is invalid.
GetLine(int)
Gets the specified line in the table.
public List<string> GetLine(int index)
Parameters
index
intThe index of the line to return.
Returns
Remarks
For more information, consider visiting the documentation available here.
Exceptions
- ArgumentOutOfRangeException
Thrown when the index is out of range.
RemoveLine(int)
Removes a line from the table given its index.
public void RemoveLine(int index)
Parameters
index
intThe index of the line to remove.
Remarks
For more information, consider visiting the documentation available here.
Exceptions
- ArgumentOutOfRangeException
Thrown when the index is out of range.
RenderElementActions()
Defines the actions to perform when the element is called to be rendered on the console.
[Visual]
protected override void RenderElementActions()
Reset()
Clears the table.
public void Reset()
Remarks
For more information, consider visiting the documentation available here.
SetExcludeFooter(bool)
Sets the table to exclude the footer.
public void SetExcludeFooter(bool excludeFooter = true)
Parameters
excludeFooter
boolWhether to exclude the footer or not.
Remarks
For more information, consider visiting the documentation available here.
SetExcludeHeader(bool)
Sets the table to exclude the header.
public void SetExcludeHeader(bool excludeHeader = true)
Parameters
excludeHeader
boolWhether to exclude the header or not.
Remarks
For more information, consider visiting the documentation available here.
UpdateBordersType(BordersType)
Updates the type of the borders of the table.
public void UpdateBordersType(BordersType bordersType)
Parameters
bordersType
BordersTypeThe type of the borders of the table.
Remarks
For more information, consider visiting the documentation available here.
UpdateFooterText(string)
Updates the text of the footer.
public void UpdateFooterText(string footerText)
Parameters
footerText
stringThe text of the footer.
Remarks
For more information, consider visiting the documentation available here.
UpdateHeaders(List<string>)
Updates the headers of the table.
public void UpdateHeaders(List<string> headers)
Parameters
Remarks
For more information, consider visiting the documentation available here.
UpdateLine(int, List<string>)
Updates a line in the table.
public void UpdateLine(int index, List<string> line)
Parameters
Remarks
For more information, consider visiting the documentation available here.
Exceptions
- ArgumentOutOfRangeException
Thrown when the index is out of range.
- ArgumentException
Thrown when the number of columns in the table is not consistent with itself or with the headers.
UpdatePlacement(Placement)
Updates the placement of the table.
public void UpdatePlacement(Placement placement)
Parameters
placement
PlacementThe placement of the table.
Remarks
For more information, consider visiting the documentation available here.
UpdateTitle(string)
Updates the title of the table.
public void UpdateTitle(string title)
Parameters
title
stringThe title to update.
Remarks
For more information, consider visiting the documentation available here.