PromptPlus API:IControlTable
IControlTable<T>
Namespace: PPlus.Controls
Represents the interface with all Methods of the Table control
public interface IControlTable<T> : IPromptControls<Boolean>
Type Parameters
T
Implements IPromptControls<Boolean>
Methods
AddColumn(Expression<Func<T, Object>>, UInt16, Func<Object, String>, Alignment, String, Alignment, Boolean, Boolean, Nullable<UInt16>)
Add Column
AddColumn cannot be used with AutoFill
IControlTable<T> AddColumn(Expression<Func<T, Object>> field, ushort width, Func<Object, String> format, Alignment alignment, string title, Alignment titlealignment, bool titlereplaceswidth, bool textcrop, Nullable<UInt16> maxslidinglines)
Parameters
field
Expression<Func<T, Object>>
Expression that defines the field associated with the column
width
UInt16
column size
format
Func<Object, String>
Function to format the field.If not informed, it will be ToString()
alignment
Alignment
alignment content
title
String
The Column title
titlealignment
Alignment
alignment title
titlereplaceswidth
Boolean
title width overrides column width when greater
textcrop
Boolean
If true the value will be truncated by the column size, otherwise, the content will be written in several lines
maxslidinglines
Nullable<UInt16>
Maximum Sliding Lines when the content length is greater than the column size and textcrop = false.
Returns
AddFormatType<T1>(Func<Object, String>)
Function to format columns by field type when not specified by ‘AddColumn’.
IControlTable<T> AddFormatType<T1>(Func<Object, String> funcfomatType)
Type Parameters
T1
Type to convert
Parameters
funcfomatType
Func<Object, String>
The function
Returns
AddItem(T)
Add item to list
IControlTable<T> AddItem(T value)
Parameters
value
T
Item to add
Returns
AddItems(IEnumerable<T>)
Add items to list
IControlTable<T> AddItems(IEnumerable<T> values)
Parameters
values
IEnumerable<T>
items colletion to add
Returns
AutoFill(params Nullable<UInt16>[])
Auto generate Columns
AutoFill cannot be used with AddColumn and/or AutoFit
Header alignment will always be ‘Center’
The content alignment will always be ‘Left’ and will always be with sliding lines
Columns are generated by the public properties of the data class recognized by .
TypeCode.DBNull and TypeCode.Object will be ignored.
The column size will be automatically adjusted by the title size (Name property) and the minmaxwidth parameter or content width when min/max width is null
IControlTable<T> AutoFill(params Nullable<UInt16>[] minmaxwidth)
Parameters
minmaxwidth
Nullable<UInt16>[]
minimum and maximum width
Returns
AutoFit(params UInt16[])
Set the grid to auto-resize to current console width
AutoFit cannot be used with AutoFill
IControlTable<T> AutoFit(params UInt16[] indexColumn)
Parameters
indexColumn
UInt16[]
List (cardinality) of columns that will be affected.
If none all columns that will be affected
Returns
Config(Action<IPromptConfig>)
Custom config the control.
IControlTable<T> Config(Action<IPromptConfig> context)
Parameters
context
Action<IPromptConfig>
action to apply changes. IPromptConfig
Returns
HideHeaders(Boolean)
Hide columns headers. Default false.
IControlTable<T> HideHeaders(bool value)
Parameters
value
Boolean
Hide headers
Returns
Interaction<T1>(IEnumerable<T1>, Action<IControlTable<T>, T1>)
Execute a action foreach item of colletion passed as a parameter
IControlTable<T> Interaction<T1>(IEnumerable<T1> values, Action<IControlTable<T>, T1> action)
Type Parameters
T1
Layout external colletion
Parameters
values
IEnumerable<T1>
Colletion for interaction
action
Action<IControlTable<T>, T1>
Action to execute
Returns
Layout(TableLayout)
The Table layout. Default value is ‘TableLayout.SingleGridFull’
IControlTable<T> Layout(TableLayout value)
Parameters
value
TableLayout
The TableLayout
Returns
OrderBy(Expression<Func<T, Object>>)
Sort items by expression
IControlTable<T> OrderBy(Expression<Func<T, Object>> value)
Parameters
value
Expression<Func<T, Object>>
expresion to sort the rows
Returns
OrderByDescending(Expression<Func<T, Object>>)
Sort Descending items by expression
IControlTable<T> OrderByDescending(Expression<Func<T, Object>> value)
Parameters
value
Expression<Func<T, Object>>
expresion to sort the rows
Returns
SeparatorRows(Boolean)
Set separator between rows. Default false.
IControlTable<T> SeparatorRows(bool value)
Parameters
value
Boolean
separator between rows
Returns
Styles(TableStyles, Style)
Overwrite Styles
IControlTable<T> Styles(TableStyles content, Style value)
Parameters
content
TableStyles
TableStyles of content
Returns
Title(String, Alignment, TableTitleMode)
Set Title Table
IControlTable<T> Title(string value, Alignment alignment, TableTitleMode titleMode)
Parameters
value
String
Title
alignment
Alignment
alignment title. Default value is Alignment.Center
titleMode
TableTitleMode
InLine(Default): Write the title above the grid. InRow : Write the title inside the grid as a row