PromptPlus API:IControlTableSelect
IControlTableSelect<T>
Namespace: PPlus.Controls
Represents the interface with all Methods of the Table Select control
public interface IControlTableSelect<T> : IPromptControls<ResultTableSelect<T>>
Type Parameters
T
Implements IPromptControls<ResultTableSelect<T>>
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
IControlTableSelect<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’.
IControlTableSelect<T> AddFormatType<T1>(Func<Object, String> funcfomatType)
Type Parameters
T1
Type to convert
Parameters
funcfomatType
Func<Object, String>
The function
Returns
AddItem(T, Boolean)
Add item to list
IControlTableSelect<T> AddItem(T value, bool disable)
Parameters
value
T
Item to add
disable
Boolean
true item disabled, otherwise no
Returns
AddItems(IEnumerable<T>, Boolean)
Add items to list
IControlTableSelect<T> AddItems(IEnumerable<T> values, bool disable)
Parameters
values
IEnumerable<T>
items colletion to add
disable
Boolean
true item disabled, otherwise no
Returns
AddItemsTo(AdderScope, params T[])
Add Items to list with scope Disable/Remove AdderScope
At startup the list items will be compared and will be removed or disabled
Tip: Use for custom comparer
IControlTableSelect<T> AddItemsTo(AdderScope scope, params T[] values)
Parameters
scope
AdderScope
scope Disable/Remove
values
T[]
items colletion
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
IControlTableSelect<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
IControlTableSelect<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
AutoSelect(Boolean)
Automatically select and finalize item when only one item is in the list . Default false.
IControlTableSelect<T> AutoSelect(bool value)
Parameters
value
Boolean
Automatically select
Returns
ChangeDescription(Func<T, Int32, Int32, String>)
Dynamically change the description using a user role
IControlTableSelect<T> ChangeDescription(Func<T, Int32, Int32, String> value)
Parameters
value
Func<T, Int32, Int32, String>
function to apply change
Func(T, int, int, string) = T = item, int = current row (base0) , int = current col (base0)
Returns
ColumnsNavigation(Boolean)
Enable Columns Navigation when Templates is active. Default false.
When the column size is greater than the screen size, the content will be truncated
IControlTableSelect<T> ColumnsNavigation(bool value)
Parameters
value
Boolean
Enable Columns Navigation
Returns
Config(Action<IPromptConfig>)
Custom config the control.
IControlTableSelect<T> Config(Action<IPromptConfig> context)
Parameters
context
Action<IPromptConfig>
action to apply changes. IPromptConfig
Returns
Default(T)
Default value selected.
IControlTableSelect<T> Default(T value)
Parameters
value
T
Value default
Returns
EqualItems(Func<T, T, Boolean>)
Custom item comparator
IControlTableSelect<T> EqualItems(Func<T, T, Boolean> comparer)
Parameters
comparer
Func<T, T, Boolean>
function comparator
Returns
FilterByColumns(FilterMode, params UInt16[])
Set Columns used by Filter strategy.
IControlTableSelect<T> FilterByColumns(FilterMode filter, params UInt16[] indexColumn)
Parameters
filter
FilterMode
Filter strategy for filter rows.Default value is FilterMode.Disabled
indexColumn
UInt16[]
list (cardinality) of columns
Returns
HideHeaders(Boolean)
Hide columns headers. Default false.
IControlTableSelect<T> HideHeaders(bool value)
Parameters
value
Boolean
Hide headers
Returns
HideSelectorRow(Boolean)
Hide selector row. Default false.
IControlTableSelect<T> HideSelectorRow(bool value)
Parameters
value
Boolean
Hide selector row
Returns
Interaction<T1>(IEnumerable<T1>, Action<IControlTableSelect<T>, T1>)
Execute a action foreach item of colletion passed as a parameter
IControlTableSelect<T> Interaction<T1>(IEnumerable<T1> values, Action<IControlTableSelect<T>, T1> action)
Type Parameters
T1
Layout external colletion
Parameters
values
IEnumerable<T1>
Colletion for interaction
action
Action<IControlTableSelect<T>, T1>
Action to execute
Returns
Layout(TableLayout)
The Table layout. Default value is ‘TableLayout.SingleGridFull’
IControlTableSelect<T> Layout(TableLayout value)
Parameters
value
TableLayout
The TableLayout
Returns
OrderBy(Expression<Func<T, Object>>)
Sort items by expression
IControlTableSelect<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
IControlTableSelect<T> OrderByDescending(Expression<Func<T, Object>> value)
Parameters
value
Expression<Func<T, Object>>
expresion to sort the rows
Returns
OverwriteDefaultFrom(String, Nullable<TimeSpan>)
Overwrite defaults start selected value with last result saved on history.
IControlTableSelect<T> OverwriteDefaultFrom(string value, Nullable<TimeSpan> timeout)
Parameters
value
String
name of file to save history
timeout
Nullable<TimeSpan>
The timeout for valid items saved. Default value is 365 days
Returns
PageSize(Int32)
Set max.item view per page.
Default value : 10.The value must be greater than or equal to 1
IControlTableSelect<T> PageSize(int value)
Parameters
value
Int32
Number of Max.rows
Returns
SeparatorRows(Boolean)
Set separator between rows. Default false.
IControlTableSelect<T> SeparatorRows(bool value)
Parameters
value
Boolean
separator between rows
Returns
Styles(TableSelectStyle, Style)
Overwrite Styles
IControlTableSelect<T> Styles(TableSelectStyle content, Style value)
Parameters
content
TableSelectStyle
TableSelectStyle of content
Returns
Templates(Func<T, Int32, Int32, String>, Func<T, Int32, Int32, String>)
Template for selected item and finished select
IControlTableSelect<T> Templates(Func<T, Int32, Int32, String> selectedTemplate, Func<T, Int32, Int32, String> finishTemplate)
Parameters
selectedTemplate
Func<T, Int32, Int32, String>
message template function when selected item.
Func(T, int, int, string) = T = item, int = current row (base0) , int = current col (base0)
finishTemplate
Func<T, Int32, Int32, String>
message template function when finish control with seleted item
Func(T, int, int, string) = T = item, int = current row (base0) , int = current col (base0)
Returns
Title(String, Alignment, TableTitleMode)
Set Title Table
IControlTableSelect<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