Skip to content

BasesViewConfig

Official

The in-memory representation of a single entry in the “views” section of a Bases file. Contains settings and configuration options set by the user from the toolbar menus and view options.

Import:

import { BasesViewConfig } from 'obsidian';

Signature:

export class BasesViewConfig

Constructor

new BasesViewConfig(query: string, type: string, name: string)

Constructor.

To get the constructor instance, use getBasesViewConfigConstructor from obsidian-typings/implementations.

Properties

Property Type Description
name string User-friendly name for this view.
query unknown The Bases query this view belongs to.
type string The view type identifier (e.g. 'table').

Methods

Method Returns Description
clone(name) BasesViewConfig Creates a copy of this config under a new view name.
get(key) unknown Retrieve the user-configured value of options exposed in obsidian#BasesViewRegistration.options.
getAll() Record<string, unknown> Gets all stored configuration data for the view.
getAsPropertyId(key) BasesPropertyId | null Retrieve a user-configured value from the config, converting it to a obsidian#BasesPropertyId. Returns null if the requested key is not present in the config, or if the value is invalid.
getDisplayName(propertyId) string Retrieve a friendly name for the provided property. If the property has been renamed by the user in the Base config, that value is returned. File properties may have a default name that is returned, otherwise the name with the property type prefix removed is returned.
getEvaluatedFormula(view, key) Value Retrieve a user-configured value from the config, evaluating it as a formula in the context of the current Base. For embedded bases, or bases in the sidebar, this means evaluating the formula against the currently active file.
getLimit() number Gets the configured row limit for the view.
getOrder() BasesPropertyId[] Ordered list of properties to display in this view. In a table, these can be interpreted as the list of visible columns. Order is configured by the user through the properties toolbar menu.
getPropertyConfig(property) unknown Gets the per-property config for a property.
getSort() BasesSortConfig[] Retrieve the sorting config for this view. Sort is configured by the user through the sort toolbar menu. Removes invalid sort configs. If no (valid) sort config, returns an empty array. Does not validate that the properties exists.

Note that data from obsidian#BasesQueryResult will be presorted.
getSummaryKey(property) null | string Gets the summary function key configured for a property.
getViewName() string Gets the user-friendly name of the view.
serialize() Record<string, unknown> Serializes the view config to a plain object.
set(key, value) void Store configuration data for the view. Views should prefer obsidian#BasesViewRegistration.options to allow users to configure options where appropriate.
setGroupBy(groupBy) void Sets the group-by config for the view.
setLimit(limit) void Sets the row limit for the view.
setOrder(order) void Sets the ordered list of properties to display.
setSortProperty(property, direction) void Updates the sort config for a property.
setSummaryKey(property, summaryKey) void Sets the summary function key for a property.

Links to this page: