Class BaseGridCustomRelatedCollectionController<SI, T>
The system controller used for automatically creating a IBaseGrid<T> according to a ICustomGrid definition
Uses the GridViewControllerCustomViewParams parameter for the view to determine the ICustomGrid to load the defintion of
Inheritance
Implements
Inherited Members
Namespace: LemonEdge.Client.Core.Views.Core
Assembly: LemonEdge.ClientCore.dll
Syntax
public class BaseGridCustomRelatedCollectionController<SI, T> : BaseGridRelatedCollectionController<SI, T>, IBaseGridController, ICollectionExportable, INewGridItemImplementor<T>, ICopyGridItemImplementor<T>, IGrid, IDeleteGridItemImplementor<T>, ISearchController, IModelViewController where SI : IBaseEntity where T : IBaseEntity
Type Parameters
Name | Description |
---|---|
SI | The system controller used for automatically creating a according to a definition Uses the parameter for the view to determine the to load the defintion of |
T | The entity type to be displayed and edited by this grid controller |
Constructors
BaseGridCustomRelatedCollectionController(IBaseGridRelatedCollection<SI, T>)
Creates a new system BaseGridCustomController with the specified instance of a default grid view
Declaration
public BaseGridCustomRelatedCollectionController(IBaseGridRelatedCollection<SI, T> view)
Parameters
Type | Name | Description |
---|---|---|
IBaseGridRelatedCollection<SI, T> | view | The instance of the default grid view in the client application |
Properties
AllowNewEntityFromLookupColumn
Declaration
public override bool AllowNewEntityFromLookupColumn { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
AutoOpenNewItemInTab
Indicates when creating a new item in the grid that it should automatically be opened in a new tab as well
The default is true if the type T is an entity that is not a IsStandingDataEntity
Declaration
public override bool AutoOpenNewItemInTab { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
CanCreateNew
Indicates if the user can create new items in the grid
The default implementation is true, allowing specific controller implementations to provide override values
Declaration
public override bool CanCreateNew { get; }
Property Value
Type | Description |
---|---|
bool |
Overrides
CollectionRelationshipColumnName
This is the property on the T entities that holds a relationship value that points to the SingleItem type
This controller will automatically use that to filter the correct entities for the grid in AlterQuery(QueryableExecuter<TCollection>)
Declaration
public override string CollectionRelationshipColumnName { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
PopulateNewFromLookupColumnName
Returns OpenFromRelatedColumnName
Declaration
public override string PopulateNewFromLookupColumnName { get; }
Property Value
Type | Description |
---|---|
string |
Overrides
Methods
AlterQuery(QueryableExecuter<T>)
Additionally alters the base query alteration by ensuring all entities returned are related to the SingleItem by having their CollectionRelationshipColumnName have the same value as the SingleItem ID
This is achieved via AddRelationshipJoin(QueryableExecuter<TCollection>) which can be overidden to customise how the entities of type T are precisely related to the SingleItem if not directly through that join
Declaration
protected override QueryableExecuter<T> AlterQuery(QueryableExecuter<T> query)
Parameters
Type | Name | Description |
---|---|---|
QueryableExecuter<T> | query | The existing query to return all the results that will populate the grid |
Returns
Type | Description |
---|---|
QueryableExecuter<T> | An altered query that also ensures all entities returned are related to the SingleItem by having their CollectionRelationshipColumnName have the same value as the SingleItem ID |
Overrides
CanDelete(T)
Indicates if the selected item is allowed to be deleted based on the status of the item itself
The default implementation is false, allowing specific controller implementations to provide override values
Declaration
public override Task<bool> CanDelete(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The item to check if it can be deleted |
Returns
Type | Description |
---|---|
Task<bool> | True if the specified item can be deleted |
Overrides
ColumnGroups()
Returns all the groups the columns belong to (if any) as defined in the GroupinName for the LoadAdditionalColumns()
Declaration
public override IEnumerable<GridColumnGroup> ColumnGroups()
Returns
Type | Description |
---|---|
IEnumerable<GridColumnGroup> | All the groups the columns belong to (if any) as defined in the GroupinName for the LoadAdditionalColumns() |
Overrides
Columns()
Returns all the columns loaded from LoadAdditionalColumns()
Declaration
public override IEnumerable<ControlDisplayInfo> Columns()
Returns
Type | Description |
---|---|
IEnumerable<ControlDisplayInfo> | All the columns loaded from LoadAdditionalColumns() which dynamically represent the definitions in ICustomGridColumn for this ICustomGrid |
Overrides
DisplayItem(object)
Clears the view, determines if CanWrite is true, and if it ShouldDisplayItem(object?) then calls AddHandlers(object) and DisplayUI()
Declaration
public override Task DisplayItem(object item)
Parameters
Type | Name | Description |
---|---|---|
object | item | The item to be displayed against this View |
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |
Overrides
InitAsync()
Provides the controller a chance to initialize any dependant data. Called once by the system after controller creation.
Declaration
public override Task InitAsync()
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |
Overrides
LoadAdditionalColumns()
Loads all the control definitions as defined by the ICustomGridColumn collection for the ICustomGrid specified in the GridViewControllerCustomViewParams for this view
Declaration
protected override Task LoadAdditionalColumns()
Returns
Type | Description |
---|---|
Task | All the control definitions as defined by the ICustomGridColumn collection for the ICustomGrid specified in the GridViewControllerCustomViewParams for this view |
Overrides
OnTrackedItemChanged(object, string)
Provids a mechanism for handling changes for any item in the context
By default this is used to apply changes made to a selected item automatically to all other selected items in the grid (if multi-select is enabled)
Declaration
protected override void OnTrackedItemChanged(object item, string propName)
Parameters
Type | Name | Description |
---|---|---|
object | item | The item that changed |
string | propName | The property name of the changed value |
Overrides
RemoveItems(IEnumerable<T>)
Removes the specified set of items from the grid and if the items in the grid have a property marked as SequenceStart then it will decrement the ones above these deleted items to reflect their change in order
Declaration
public override Task RemoveItems(IEnumerable<T> items)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | items | The items to be removed from the CurrentItems |
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |
Overrides
UpdateNewItem(T)
Updates any new item created in this grid to also have the CollectionRelationshipColumnName property hold the value of the SingleItem ID
Declaration
protected override Task UpdateNewItem(T item)
Parameters
Type | Name | Description |
---|---|---|
T | item | The new item created for this grid |
Returns
Type | Description |
---|---|
Task | A task indicating the completion of the operation |