Table of Contents

Class GridEditScreenBase<TModel, TListModel>

Namespace
Dynamicweb.CoreUI.Screens
Assembly
Dynamicweb.CoreUI.dll

Base class for CoreUI grid-edit screens that render an inline-editable data grid. Subclass this to create a screen where users can edit multiple records directly in a grid.

public abstract class GridEditScreenBase<TModel, TListModel> : ScreenBase where TListModel : DataListViewModel<TModel>

Type Parameters

TModel

The row model type. Must derive from DataViewModelBase.

TListModel

The list-wrapping model type. Must derive from DataListViewModel<T>.

Inheritance
GridEditScreenBase<TModel, TListModel>
Derived
Inherited Members

Remarks

Override GetColumns() to define the editable columns, GetSaveCommand() to supply the command that persists changes, and GetScreenName() to set the screen title. Use CreateColumn<TValue>(Expression<Func<TModel, TValue>>, GridColumnComponentDefinition?, bool, bool, bool, bool?) to build strongly-typed column definitions.

Properties

Query

Gets the data query used to populate the grid. Set by the framework before the screen is built.

public DataQuerySimpleListBase<TModel, TListModel>? Query { get; }

Property Value

DataQuerySimpleListBase<TModel, TListModel>

Methods

CreateColumn(string, GridColumnComponentDefinition?, bool, bool, bool, bool?)

Creates a GridColumn from a model property identified by its system name. Call this from GetColumns() when you cannot use a compile-time expression.

protected GridColumn? CreateColumn(string systemName, GridColumnComponentDefinition? columnTemplate = null, bool enableFind = true, bool enableSetValueAction = true, bool enableSearchAndReplaceAction = true, bool? isGroupable = null)

Parameters

systemName string

The system name of the model property to build the column for.

columnTemplate GridColumnComponentDefinition

An optional cell component definition overriding the auto-resolved editor type.

enableFind bool

Whether the find action is enabled for this column. Defaults to true.

enableSetValueAction bool

Whether the set-value bulk action is enabled. Defaults to true.

enableSearchAndReplaceAction bool

Whether the search-and-replace action is enabled. Defaults to true.

isGroupable bool?

Whether the column can be used for row grouping. Defaults to true when null.

Returns

GridColumn

A configured GridColumn, or null if no mapping exists for systemName.

CreateColumn<TValue>(Expression<Func<TModel, TValue>>, GridColumnComponentDefinition?, bool, bool, bool, bool?)

Creates a GridColumn from a strongly-typed model property expression. Call this from GetColumns() to build column definitions.

protected GridColumn CreateColumn<TValue>(Expression<Func<TModel, TValue>> expression, GridColumnComponentDefinition? columnTemplate = null, bool enableFind = true, bool enableSetValueAction = true, bool enableSearchAndReplaceAction = true, bool? isGroupable = null)

Parameters

expression Expression<Func<TModel, TValue>>

A lambda expression pointing to the model property, e.g. m => m.Name.

columnTemplate GridColumnComponentDefinition

An optional cell component definition overriding the auto-resolved editor type.

enableFind bool

Whether the find action is enabled for this column. Defaults to true.

enableSetValueAction bool

Whether the set-value bulk action is enabled. Defaults to true.

enableSearchAndReplaceAction bool

Whether the search-and-replace action is enabled. Defaults to true.

isGroupable bool?

Whether the column can be used for row grouping. Defaults to true when null.

Returns

GridColumn

A configured GridColumn ready to be returned from GetColumns().

Type Parameters

TValue

The property value type.

CreateSorting<TValue>(Expression<Func<TModel, TValue>>, SortDirection)

Creates a SortInfo entry for a model property, for use in GetSorting().

protected SortInfo CreateSorting<TValue>(Expression<Func<TModel, TValue>> columnExpression, SortDirection direction)

Parameters

columnExpression Expression<Func<TModel, TValue>>

A lambda expression pointing to the model property to sort by.

direction SortDirection

The sort direction (Ascending or Descending).

Returns

SortInfo

A SortInfo that can be returned from GetSorting().

Type Parameters

TValue

The property value type.

GetColumnRules(string)

Returns conditional styling or behavior rules for the column with the given system name. Called once per column when building the grid.

protected virtual IEnumerable<GridColumnRule?>? GetColumnRules(string systemName)

Parameters

systemName string

The system name of the column.

Returns

IEnumerable<GridColumnRule>

A collection of GridColumnRule instances, or null for no rules.

GetColumns()

Returns the configurable columns that users can show, hide, and reorder. This is the primary override point for defining the grid's editable fields. Called once when building the grid.

protected virtual IEnumerable<GridColumn>? GetColumns()

Returns

IEnumerable<GridColumn>

A collection of GridColumn instances, or null for no columns.

GetCustomConfiguration()

Returns a custom screen configuration that overrides field inclusion or freeze settings for this screen. Called when resolving the active configuration. Return null to use the default configuration.

protected virtual GridEditScreenConfiguration? GetCustomConfiguration()

Returns

GridEditScreenConfiguration

A GridEditScreenConfiguration override, or null.

GetDefaultGridConfiguration()

Returns the default grid configuration used when no user preset or custom configuration is active. Override to control which fields are included or excluded by default.

protected virtual GridEditScreenConfiguration GetDefaultGridConfiguration()

Returns

GridEditScreenConfiguration

A GridEditScreenConfiguration representing the screen's default field set.

GetDefinitionInternal()

Builds and returns the raw component tree for this screen.

protected override sealed UiComponentBase GetDefinitionInternal()

Returns

UiComponentBase

Remarks

Implement this method in every concrete screen class. The result is post-processed by GetDefinition() (injectors, trimming, preset actions) before being returned to the framework.

GetDynamicFieldColumnDefinition(string)

Returns a custom cell component definition for a dynamic field column identified by its system name. Called when a dynamic field column has no value-type-based default definition.

protected virtual GridColumnComponentDefinition? GetDynamicFieldColumnDefinition(string systemName)

Parameters

systemName string

The system name of the dynamic field.

Returns

GridColumnComponentDefinition

A GridColumnComponentDefinition for the cell editor, or null to use the auto-resolved default.

GetGroupingColumn()

Returns the name of the column by which rows are visually grouped in the grid. Called once when building the grid component.

protected virtual string? GetGroupingColumn()

Returns

string

The column name to group by, or null to disable grouping.

GetSaveCommand()

Returns the command that persists all grid edits when the user saves. Called once when building the save button.

protected virtual CommandBase? GetSaveCommand()

Returns

CommandBase

A CommandBase that saves grid changes, or null to render the screen without a save button.

GetScreenName()

Returns the display name shown in the screen's title bar and grid header. Called once when building the screen layout.

protected virtual string GetScreenName()

Returns

string

A human-readable screen name. Defaults to "Grid Edit".

GetSorting()

Returns the initial sort order applied to the grid when it is first rendered. Called once when building the grid component.

protected virtual IEnumerable<SortInfo>? GetSorting()

Returns

IEnumerable<SortInfo>

A collection of SortInfo entries defining column and direction, or null for no default sort.

GetStaticColumns()

Returns columns that are always present regardless of the user's field configuration, and whose order is not affected by the user's column ordering preferences. Called once when building the grid.

protected virtual IEnumerable<GridColumn>? GetStaticColumns()

Returns

IEnumerable<GridColumn>

A collection of always-shown GridColumn instances, or null.

ModifyDynamicFieldColumn(ModelDynamicFieldInfo, GridColumn)

Allows modifying a GridColumn after it has been auto-generated for a dynamic field. Called once per dynamic field column when building the grid.

protected virtual void ModifyDynamicFieldColumn(ModelDynamicFieldInfo dynamicField, GridColumn column)

Parameters

dynamicField ModelDynamicFieldInfo

Metadata about the dynamic field.

column GridColumn

The auto-generated column to modify in place.

OnBuildGridEditScreen()

Called once before the grid layout is built, allowing subclasses to perform setup work such as loading auxiliary data or setting configuration flags. Override this instead of overriding the sealed GetDefinitionInternal.

protected virtual void OnBuildGridEditScreen()
To top