List Views

Configuring the list view of a collection in Konstrukt, the back office UI builder for Umbraco.

A list view is a list based view of a collections entities providing such features as pagination for large collections, custom data views, searching and bulk actions.

Configuring a list view

The list view configuration is a sub configuration of a Collection config builder instance and is accessed via it's ListView method.

ListView(Lambda listViewConfig = null) : KonstruktListViewConfigBuilder<TEntityType>

Accesses the list view config of the given collection.

// Example
collectionConfig.ListView(listViewConfig => {
    ...
});

Adding a field to the list view

AddField(Lambda propertyExpression, Lambda fieldConfig = null) : KonstruktListViewFieldConfigBuilder<TEntityType, TValueType>

Adds the given property to the list view.

// Example
listViewConfig.AddField(p => p.FirstName, fieldConfig => {
    ...
});

Changing the heading of a field

SetHeading(string heading) : KonstruktListViewFieldConfigBuilder<TEntityType, TValueType>

Sets the heading for the list view field.

// Example
fieldConfig.SetHeading("First Name");

Formatting the value of a field

SetFormat(Lambda formatExpression) : KonstruktListViewFieldConfigBuilder<TEntityType, TValueType>

Sets the format expression for the list view field.

// Example
fieldConfig.SetFormat((v, p) => $"{v} years old");

Setting the view of a field

Field views allow you to customize the markup of the field in the list view so that you can show more rich visualizations of the fields content. See Field Views Documentation for more info.

SetView(string viewComponentName) : KonstruktListViewFieldConfigBuilder<TEntityType, TValueType>

Sets the view component for the list view field.

// Example
fieldConfig.SetView("ImageFieldView");

SetView<TView>() : KonstruktListViewFieldConfigBuilder<TEntityType, TValueType>

Sets the view component for the list view field.

// Example
fieldConfig.SetView<ImageFieldView>();

Setting the visibility of a field

SetVisibility(Predicate<KonstruktListViewFieldVisibilityContext> visibilityExpression) : KonstruktListViewFieldConfigBuilder<TEntityType, TValueType>

Sets the runtime visibility of the list view field.

// Example
fieldConfig.SetVisibility(ctx => ctx.UserGroups.Any(x => x.Alias == "editor"));

Changing the page size

SetPageSize(int pageSize) : KonstruktListViewConfigBuilder<TEntityType>

Sets the number of items to display per page for the given list view.

// Example
listViewConfig.SetPageSize(20);

Last updated