Class RepeaterField
Represents a repeater field that is used to repeat a set of form components.
public class RepeaterField : TrinityField<RepeaterField, string>, ITrinityComponent, ITrinityField, IFormComponent, IHasSchema, IHasRelationship
- Inheritance
-
RepeaterField
- Implements
- Inherited Members
Constructors
RepeaterField(string)
public RepeaterField(string columnName)
Parameters
columnName
string
Properties
CanCreateItem
Gets or sets a value indicating whether the user can create items.
public bool CanCreateItem { get; set; }
Property Value
- bool
true
if the user can create items; otherwise,false
.
CanDeleteItem
Gets or sets a value indicating whether the user can delete items.
public bool CanDeleteItem { get; set; }
Property Value
- bool
true
if the user can delete items; otherwise,false
.
CanMoveItem
Gets or sets a value indicating whether the user can move items.
public bool CanMoveItem { get; set; }
Property Value
- bool
true
if the user can move items; otherwise,false
.
ComponentName
The component name in the front-end side.
public override string ComponentName { get; }
Property Value
Fields
Gets or sets the dictionary of fields.
protected Dictionary<string, object> Fields { get; set; }
Property Value
ForeignColumn
Gets or sets the name of the foreign column for the relationship.
public string? ForeignColumn { get; set; }
Property Value
ForeignColumnName
Gets or sets the name of the foreign column in the database.
public string? ForeignColumnName { get; set; }
Property Value
ForeignTable
Gets or sets the name of the foreign table for the relationship.
public string? ForeignTable { get; set; }
Property Value
ForeignTableName
Gets or sets the name of the foreign table in the database.
public string? ForeignTableName { get; set; }
Property Value
HasRelationshipByDefault
A boolean that indicates whether this column has a relationship by default.
public bool HasRelationshipByDefault { get; set; }
Property Value
IsCollapsible
Gets or sets a value indicating whether the repeater field is collapsible.
public bool IsCollapsible { get; protected set; }
Property Value
IsSavable
Whether the field should be saved into the database or not.
public override bool IsSavable { get; set; }
Property Value
LocalColumnName
Gets or sets the name of the local column in the database.
protected string? LocalColumnName { get; set; }
Property Value
RelationshipName
The name of the relationship.
public string? RelationshipName { get; set; }
Property Value
Schema
Gets or sets the schema for the component.
public List<object>? Schema { get; set; }
Property Value
Remarks
The schema can be a list of objects of any ITrinityComponent.
Methods
GetAssociatesRelationshipQuery(QueryFactory, string?, int, string?)
A method that gets the associates relationship query using the specified queryFactory, value, offset, search string, and returns a list of the key-value pairs.
public Task<List<KeyValuePair<string, string>>> GetAssociatesRelationshipQuery(QueryFactory queryFactory, string? value, int offset, string? search = null)
Parameters
queryFactory
QueryFactoryThe query factory used to create the query
value
stringThe value to search for, if any.
offset
intThe offset to use
search
stringThe search string to use
Returns
- Task<List<KeyValuePair<string, string>>>
A list of key-value pairs
PrepareForValidation(IValidator, IReadOnlyDictionary<string, object?>, ModelStateDictionary)
Prepares the field for validation.
public override void PrepareForValidation(IValidator validator, IReadOnlyDictionary<string, object?> form, ModelStateDictionary modelState)
Parameters
validator
IValidatorThe validator to use.
form
IReadOnlyDictionary<string, object>The form to validate.
modelState
ModelStateDictionary
SelectQuery(Query)
Adds a select query for the field to a query builder.
public override void SelectQuery(Query query)
Parameters
query
QueryThe query builder to use.
SelectRelationshipQuery(QueryFactory, List<IDictionary<string, object?>>, Sort?)
A method that selects the relationship query using the specified queryFactory and list of records, returns a list of the selected relationships.
public Task<List<IDictionary<string, object?>>> SelectRelationshipQuery(QueryFactory queryFactory, List<IDictionary<string, object?>> records, Sort? sort = null)
Parameters
queryFactory
QueryFactoryThe query factory used to create the query
records
List<IDictionary<string, object>>The list of records to select from
sort
SortThe sorting object
Returns
- Task<List<IDictionary<string, object>>>
A list of selected relationships
SetAsCollapsible(bool)
Sets a value indicating whether the repeater field is collapsible.
public RepeaterField SetAsCollapsible(bool isCollapsible = true)
Parameters
isCollapsible
boolThe value indicating whether the repeater field is collapsible.
Returns
- RepeaterField
The current instance of the RepeaterField.
SetCanCreateItem(bool)
Sets whether the user can create items.
public virtual RepeaterField SetCanCreateItem(bool can = true)
Parameters
can
boolWhether the user can create items.
Returns
- RepeaterField
The RepeaterField instance.
SetCanDeleteItem(bool)
Sets whether the user can delete items.
public virtual RepeaterField SetCanDeleteItem(bool can = true)
Parameters
can
boolWhether the user can delete items.
Returns
- RepeaterField
The RepeaterField instance.
SetCanMoveItem(bool)
Sets whether the user can move items.
public virtual RepeaterField SetCanMoveItem(bool can = true)
Parameters
can
boolWhether the user can move items.
Returns
- RepeaterField
The RepeaterField instance.
SetRelationship(string, string, string)
Sets the relationship between the local column and the foreign column in the database.
public RepeaterField SetRelationship(string localColumnName, string foreignColumnName, string foreignTableName)
Parameters
localColumnName
stringThe name of the local column in the database.
foreignColumnName
stringThe name of the foreign column in the database.
foreignTableName
stringThe name of the foreign table in the database.
Returns
- RepeaterField
The current instance of the RepeaterField.
SetSchema(List<IFormComponent>)
Sets the schema for the repeater field.
public RepeaterField SetSchema(List<IFormComponent> schema)
Parameters
schema
List<IFormComponent>The schema to set.
Returns
- RepeaterField
The RepeaterField instance.