Table of Contents

Class TrinityColumn<T, TDeserialization>

Namespace
AbanoubNassem.Trinity.Components.TrinityColumn
Assembly
AbanoubNassem.Trinity.dll

Represents a column in TrinityTable. This is an abstract class that provides common properties and methods for all types of columns.

public abstract class TrinityColumn<T, TDeserialization> : TrinityComponent<T, TDeserialization>, ITrinityColumn, ITrinityComponent where T : TrinityColumn<T, TDeserialization>

Type Parameters

T

The type of the derived class.

TDeserialization

The type of the deserialization object used for deserializing JSON data.

Inheritance
TrinityComponent<T, TDeserialization>
TrinityColumn<T, TDeserialization>
Implements
Derived
Inherited Members

Constructors

TrinityColumn(string)

Initializes a new instance of the T class with the specified column name.

protected TrinityColumn(string columnName)

Parameters

columnName string

The name of the column.

Properties

CaseSensitive

Gets or sets a value indicating whether searches/filters on this column are case sensitive.

protected bool CaseSensitive { get; set; }

Property Value

bool

Color

Gets or sets the color of this column.

public string? Color { get; protected set; }

Property Value

string

ColumnName

Gets or sets the name of the column.

public string ColumnName { get; set; }

Property Value

string

CustomFilter

Gets or sets custom filter of this column.

public object? CustomFilter { get; protected set; }

Property Value

object

Description

Gets or sets the description of the column.

public object? Description { get; protected set; }

Property Value

object

DescriptionPosition

Gets or sets the position of the description relative to the column.

public string? DescriptionPosition { get; protected set; }

Property Value

string

DescriptionUsingCallback

Gets or sets the description callback of the column.

protected TrinityColumn<T, TDeserialization>.CallbackWithRecord<string>? DescriptionUsingCallback { get; set; }

Property Value

TrinityColumn<T, TDeserialization>.CallbackWithRecord<string>

Exportable

Gets or sets a value indicating whether this column should be exportable.

public bool Exportable { get; protected set; }

Property Value

bool

ExtraAttributesCallback

Gets or sets a callback function to generate extra attributes for this column.

protected TrinityColumn<T, TDeserialization>.CallbackWithRecord<Dictionary<string, string>>? ExtraAttributesCallback { get; set; }

Property Value

TrinityColumn<T, TDeserialization>.CallbackWithRecord<Dictionary<string, string>>

FontFamily

Gets or sets the font family of the column.

public string? FontFamily { get; protected set; }

Property Value

string

FormatUsingCallback

A callback function to format the value of the column using the record data.

protected TrinityColumn<T, TDeserialization>.CallbackWithRecord<string>? FormatUsingCallback { get; set; }

Property Value

TrinityColumn<T, TDeserialization>.CallbackWithRecord<string>

Remarks

The callback function should accept a Record object and return a string.

Html

Gets or sets a value indicating whether the content of this column should be rendered as HTML.

public bool Html { get; protected set; }

Property Value

bool

Icon

Gets or sets the icon of this column.

public string? Icon { get; protected set; }

Property Value

string

IconPosition

Gets or sets the position of the icon in this column.

public string? IconPosition { get; protected set; }

Property Value

string

IsGloballySearchable

Gets or sets a value indicating whether this column is globally searchable.

public bool IsGloballySearchable { get; set; }

Property Value

bool

IsIndividuallySearchable

Gets or sets a value indicating whether this column is individually searchable.

public bool IsIndividuallySearchable { get; set; }

Property Value

bool

Record

The record retrieved from the database.

protected IDictionary<string, object?> Record { get; }

Property Value

IDictionary<string, object>

Searchable

Gets or sets a value indicating whether this column is searchable.

public bool Searchable { get; protected set; }

Property Value

bool

SearchCallback

Gets or sets the callback function used for searching/filtering this column.

protected TrinityColumn<T, TDeserialization>.FiltersCallback? SearchCallback { get; set; }

Property Value

TrinityColumn<T, TDeserialization>.FiltersCallback

SearchPlaceholder

The placeholder text displayed in the search input field.

public string? SearchPlaceholder { get; protected set; }

Property Value

string

Size

Gets or sets the size of the column.

public string? Size { get; protected set; }

Property Value

string

Remarks

The size is specified using a SizeTypes value.

Sortable

Gets or sets a value indicating whether this column is sortable.

public bool Sortable { get; protected set; }

Property Value

bool

SortCallback

Gets or sets the callback function used for sorting this column.

protected TrinityColumn<T, TDeserialization>.QueryCallbackWithString? SortCallback { get; set; }

Property Value

TrinityColumn<T, TDeserialization>.QueryCallbackWithString

Title

The value that should be used to represent the column when being displayed.

public string Title { get; protected set; }

Property Value

string

TooltipCallback

Gets or sets a callback function to generate tooltip for this column.

protected TrinityColumn<T, TDeserialization>.CallbackWithRecord<string>? TooltipCallback { get; set; }

Property Value

TrinityColumn<T, TDeserialization>.CallbackWithRecord<string>

Type

Used on the front-end side to determine what type is the component , is it (field, columns , etc).

public override string Type { get; }

Property Value

string

Weight

Gets or sets the font weight of the column.

public string? Weight { get; protected set; }

Property Value

string

Methods

Filter(Query, string)

Filters the data in this column according to the specified query and search term.

public virtual void Filter(Query query, string search)

Parameters

query Query

The query used for filtering.

search string

The search term used for filtering.

Format()

Formats the value of the column, if FormatUsingCallback defined will apply the callback function.

public virtual void Format()

SelectQuery(Query)

Adds a select clause for the current column to the specified query.

public virtual void SelectQuery(Query query)

Parameters

query Query

The query to modify.

SetAsExportable(bool)

Sets this column as exportable or not.

public T SetAsExportable(bool exportable = true)

Parameters

exportable bool

A boolean value indicating whether this column should be exportable.

Returns

T

The current instance of the T column.

SetAsHtml(bool)

Sets this column to render its content as HTML or not.

public T SetAsHtml(bool html = true)

Parameters

html bool

A boolean value indicating whether the content of this column should be rendered as HTML.

Returns

T

The current instance of the T column.

SetAsSearchable(bool, bool, bool, bool, FiltersCallback?)

Sets this column as searchable with the specified search/filtering callback function.

public virtual T SetAsSearchable(bool searchable = true, bool isIndividuallySearchable = false, bool globallySearchable = true, bool caseSensitive = false, TrinityColumn<T, TDeserialization>.FiltersCallback? searchCallback = null)

Parameters

searchable bool

A value indicating whether this column is searchable.

isIndividuallySearchable bool

A value indicating whether this column is individually searchable.

globallySearchable bool

A value indicating whether this column is globally searchable.

caseSensitive bool

A value indicating whether searches/filters on this column are case sensitive.

searchCallback TrinityColumn<T, TDeserialization>.FiltersCallback

The search/filtering callback function.

Returns

T

The current instance of the T column.

SetAsSortable(bool, QueryCallbackWithString?)

Sets this column as sortable with the specified sorting callback function.

public T SetAsSortable(bool sortable = true, TrinityColumn<T, TDeserialization>.QueryCallbackWithString? sortCallback = null)

Parameters

sortable bool

A value indicating whether this column is sortable.

sortCallback TrinityColumn<T, TDeserialization>.QueryCallbackWithString

The sorting callback function.

Returns

T

The current instance of the T column.

SetColor(string)

Sets the color of this column.

public T SetColor(string color)

Parameters

color string

The color of this column.

Returns

T

The current instance of the T column.

SetColumnName(string)

Sets the ColumnName property .

public T SetColumnName(string value)

Parameters

value string

The column name to set.

Returns

T

The instance of the derived class.

SetCustomFilter(ITrinityField, FiltersCallback?)

Sets a custom filter for this column, with an optional callback to handle filter values.

public T SetCustomFilter(ITrinityField filter, TrinityColumn<T, TDeserialization>.FiltersCallback? filterCallback = null)

Parameters

filter ITrinityField

The custom filter to use.

filterCallback TrinityColumn<T, TDeserialization>.FiltersCallback

An optional callback to handle filter values.

Returns

T

The current instance of the T column.

SetDescription(CallbackWithRecord<string>?, DescriptionPositionTypes)

Sets the description of the column with the specified position.

public T SetDescription(TrinityColumn<T, TDeserialization>.CallbackWithRecord<string>? descriptionUsingCallback, DescriptionPositionTypes pos = DescriptionPositionTypes.Bellow)

Parameters

descriptionUsingCallback TrinityColumn<T, TDeserialization>.CallbackWithRecord<string>

The description of the column.

pos DescriptionPositionTypes

The position of the description relative to the column. Default value is Bellow.

Returns

T

The current instance of the T column.

SetDescription(HtmlString, DescriptionPositionTypes)

Sets the HTML description of the column with the specified position.

public T SetDescription(HtmlString description, DescriptionPositionTypes pos = DescriptionPositionTypes.Bellow)

Parameters

description HtmlString

The HTML description of the column.

pos DescriptionPositionTypes

The position of the description relative to the column. Default value is Bellow.

Returns

T

The current instance of the T column.

SetDescription(string, DescriptionPositionTypes)

Sets the description of the column with the specified position.

public T SetDescription(string description, DescriptionPositionTypes pos = DescriptionPositionTypes.Bellow)

Parameters

description string

The description of the column.

pos DescriptionPositionTypes

The position of the description relative to the column. Default value is Bellow.

Returns

T

The current instance of the T column.

SetExtraAttributes(CallbackWithRecord<Dictionary<string, string>>)

Sets a callback function to generate extra attributes for this column.

public T SetExtraAttributes(TrinityColumn<T, TDeserialization>.CallbackWithRecord<Dictionary<string, string>> extraAttributesCallback)

Parameters

extraAttributesCallback TrinityColumn<T, TDeserialization>.CallbackWithRecord<Dictionary<string, string>>

A callback function to generate extra attributes for this column.

Returns

T

The current instance of the T column.

SetFontFamily(string)

Sets the font family of the column.

public T SetFontFamily(string fontFamily)

Parameters

fontFamily string

The font family of the column as a string. FontFamily

Returns

T

The current instance of the T column.

SetFormatUsing(CallbackWithRecord<string>)

Sets the FormatUsingCallback property of the column.

public T SetFormatUsing(TrinityColumn<T, TDeserialization>.CallbackWithRecord<string> formatUsing)

Parameters

formatUsing TrinityColumn<T, TDeserialization>.CallbackWithRecord<string>

The callback function to set.

Returns

T

The instance of the derived class.

SetIcon(string, string)

Sets the icon to be displayed for this column, with an optional position (defaults to "before").

public T SetIcon(string icon, string iconPosition = "before")

Parameters

icon string

The icon to display.

iconPosition string

The position of the icon ("before" or "after"). Defaults to "before".

Returns

T

The current instance of the T column.

SetRecord(IDictionary<string, object?>)

Setting the record after it's retrieved from the database.

public void SetRecord(IDictionary<string, object?> record)

Parameters

record IDictionary<string, object>

The record retrieved from the database.

SetSearchPlaceholder(string)

Sets the SearchPlaceholder property .

public T SetSearchPlaceholder(string searchPlaceholder)

Parameters

searchPlaceholder string

The search placeholder to set.

Returns

T

The instance of the derived class.

SetSize(SizeTypes)

Sets the size of the column.

public T SetSize(SizeTypes size)

Parameters

size SizeTypes

The size of the column as a SizeTypes value.

Returns

T

The current instance of the T column.

SetTitle(string)

Sets the Title property .

public T SetTitle(string value)

Parameters

value string

The title to set.

Returns

T

The instance of the derived class.

SetTooltip(CallbackWithRecord<string>)

Sets a callback function to generate tooltip for this column.

public T SetTooltip(TrinityColumn<T, TDeserialization>.CallbackWithRecord<string> tooltipCallback)

Parameters

tooltipCallback TrinityColumn<T, TDeserialization>.CallbackWithRecord<string>

A callback function to generate tooltip for this column.

Returns

T

The current instance of the T column.

SetWeight(string)

Sets the weight of the column font.

public T SetWeight(string weight)

Parameters

weight string

The weight of the column font as a string.

Returns

T

The current instance of the T column.

Sort(Query, string)

Sorts the data in this column according to the specified query and sorting direction.

public virtual void Sort(Query query, string direction)

Parameters

query Query

The query used for sorting.

direction string

The sorting direction ("ASC" for ascending, "DESC" for descending).