Umbraco UI Builder
CMSCloudHeartcoreDXP
16.latest
16.latest
  • Umbraco UI Builder Documentation
  • Known Issues
  • Release Notes
  • Getting Started
    • Requirements
    • Installing Umbraco UI Builder
    • Licensing
    • Configuration
    • User Interface
  • Upgrading
    • Upgrading Umbraco UI Builder
    • Version Specific Upgrade Notes
    • Migrate from Konstrukt to Umbraco UI Builder
  • How-to Guides
    • Creating your First Integration
  • Areas
    • Overview
    • Sections
      • Summary Dashboards
    • Trees
      • Folders
    • Dashboards
    • Context Apps
  • Collections
    • Overview
    • The Basics
    • List Views
      • Field Views
    • Editors
    • Child Collections
      • Child Collection Groups
      • Retrieve Child Collections
    • Related Collections
    • Entity Identifier Converters
  • Searching
    • Overview
    • Searchable Properties
  • Filtering
    • Overview
    • Global Filters
    • Data Views
      • Data Views Builders
    • Filterable Properties
  • Actions
    • Overview
    • The Basics
    • Action Visibility
    • Inbuilt Actions
  • Cards
    • Overview
    • Count Cards
    • Custom Cards
  • Property Editors
    • Overview
    • Entity Picker
  • Advanced
    • Virtual Sub Trees
    • Encrypted Properties
    • Value Mappers
    • Repositories
    • Events
  • Miscellaneous
    • Conventions
    • Umbraco Aliases
Powered by GitBook
On this page
  • Defining a Data Views Builder
  • Setting the Data Views Builder of a Collection
  • Using the SetDataViewsBuilder() Method
  • Using the SetDataViewsBuilder(Type) Method
  • Using the SetDataViewsBuilder(DataViewsBuilder<TEntityType>) Method

Was this helpful?

Edit on GitHub
Export as PDF
  1. Filtering
  2. Data Views

Data Views Builders

Learn how to configure data views builders in Umbraco UI Builder.

Data views builders allow you to create a collection’s data views dynamically at runtime. By default, Umbraco UI Builder uses hard-coded data views from the configuration. However, if you need to generate data views dynamically, a data views builder is required.

When resolving a data views builder, Umbraco UI Builder first attempts to retrieve it from the global Dependency Injection (DI) container. This allows injecting required dependencies into the builder. If no type is defined in the DI container, Umbraco UI Builder falls back to manually instantiating a new instance of the value mapper.

Defining a Data Views Builder

To define a data views builder, create a class that inherits from DataViewsBuilder<TEntityType> and implements the required abstract methods.

// Example
public class PersonDataViewsBuilder : DataViewsBuilder<Person>
{
    public override IEnumerable<DataViewSummary> GetDataViews()
    {
        // Generate and return a list of data views
    }

    public override Expression<Func<Person, bool>> GetDataViewWhereClause(string dataViewAlias)
    {
        // Return a where clause expression for the supplied data view alias
    }
}

The required methods are:

  • GetDataViews: Returns the list of data views to choose from.

  • GetDataViewWhereClause: Returns the boolean where clause expression for the given data views alias.

Setting the Data Views Builder of a Collection

Setting a data views builder is controlled via the Collections settings.

Using the SetDataViewsBuilder() Method

Sets the collection's data views builder, allowing you to define data views dynamically at runtime.

Method Syntax

SetDataViewsBuilder<TDataViewsBuilder>() : CollectionConfigBuilder<TEntityType>

Example

collectionConfig.SetDataViewsBuilder<PersonDataViewsBuilder>();

Using the SetDataViewsBuilder(Type) Method

Sets the collection's data views builder, allowing you to define data views dynamically at runtime.

Method Syntax

SetDataViewsBuilder(Type dataViewsBuilderType) : CollectionConfigBuilder<TEntityType>

Example

collectionConfig.SetDataViewsBuilder(typeof(PersonDataViewsBuilder));

Using the SetDataViewsBuilder(DataViewsBuilder<TEntityType>) Method

Sets the collection's data views builder, allowing you to define data views dynamically at runtime.

Method Syntax

SetDataViewsBuilder(DataViewsBuilder<TEntityType> dataViewsBuilder) : CollectionConfigBuilder<TEntityType>

Example

collectionConfig.SetDataViewsBuilder(new PersonDataViewsBuilder());
PreviousData ViewsNextFilterable Properties

Last updated 2 months ago

Was this helpful?