Umbraco UI Builder
CMSCloudHeartcoreDXP
10.latest (LTS)
10.latest (LTS)
  • Umbraco UI Builder Documentation
  • Known Issues
  • Release Notes
  • Installation
    • Installing Umbraco UI Builder
    • Licensing
  • Upgrading
    • Upgrading Umbraco UI Builder
    • Version Specific Upgrade Notes
    • Migrate from Konstrukt to Umbraco UI Builder
  • Getting Started
    • Overview
    • Configuration
    • User Interface
  • 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
  • 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
  • SetDataViewsBuilder<TDataViewsBuilder>() : CollectionConfigBuilder<TEntityType>
  • SetDataViewsBuilder(Type dataViewsBuilderType) : CollectionConfigBuilder<TEntityType>
  • SetDataViewsBuilder(DataViewsBuilder<TEntityType> dataViewsBuilder) : CollectionConfigBuilder<TEntityType>
Edit on GitHub
Export as PDF
  1. Filtering
  2. Data Views

Data Views Builders

Configuring data views builders in Umbraco UI Builder, the backoffice UI builder for Umbraco.

Data views builders allow you to create a collection data views list dynamically at run time. By default, Umbraco UI Builder will use the hard-coded data views defined in your Umbraco UI Builder config. However, if you need to build your data views list dynamically, then this is when you'd use a data views builder.

When Umbraco UI Builder resolves a data views builder it will attempt to do so from the global DI container. This means you can inject any dependencies that you require for your builder. If there is no type defined in the DI container, Umbraco UI Builder will fall-back to manually instantiating a new instance of value mapper.

Defining a data views builder

To define a data views builder you can create a class that inherits from the base class DataViewsBuilder<TEntityType> and implements the 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

SetDataViewsBuilder<TDataViewsBuilder>() : CollectionConfigBuilder<TEntityType>

Sets the collections data views builder which allows you to define the data views dynamically at run time.

// Example
collectionConfig.SetDataViewsBuilder<PersonDataViewsBuilder>();

SetDataViewsBuilder(Type dataViewsBuilderType) : CollectionConfigBuilder<TEntityType>

Sets the collections data views builder which allows you to define the data views dynamically at run time.

// Example
collectionConfig.SetDataViewsBuilder(typeof(PersonDataViewsBuilder));

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

Sets the collections data views builder which allows you to define the data views dynamically at run time.

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

Last updated 1 year ago

Setting a data views builder is controlled via the configuration.

collections