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

PropertyTypeDescription
namestringUser-friendly name for this view.
queryunknownThe Bases query this view belongs to.
typestringThe view type identifier (e.g. 'table').

Methods

MethodReturnsDescription
clone(name)BasesViewConfigCreates a copy of this config under a new view name.
get(key)unknownRetrieve 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 | nullRetrieve 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)stringRetrieve 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)ValueRetrieve 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()numberGets 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)unknownGets 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 | stringGets the summary function key configured for a property.
getViewName()stringGets the user-friendly name of the view.
serialize()Record<string, unknown>Serializes the view config to a plain object.
set(key, value)voidStore configuration data for the view. Views should prefer obsidian#BasesViewRegistration.options to allow users to configure options where appropriate.
setGroupBy(groupBy)voidSets the group-by config for the view.
setLimit(limit)voidSets the row limit for the view.
setOrder(order)voidSets the ordered list of properties to display.
setSortProperty(property, direction)voidUpdates the sort config for a property.
setSummaryKey(property, summaryKey)voidSets the summary function key for a property.

Links to this page: