Skip to content

BasesView

Official

View for the Bases plugin.

Import:

import { BasesView } from 'obsidian';

Signature:

export class BasesView extends Component

Extends: Component

Constructor

new BasesView(leaf: WorkspaceLeaf, basesPluginInstance: BasesPluginInstance)

Constructor.

Properties

PropertyTypeDescription
_childrenComponent[]Child Components attached to current component, will be unloaded on unloading parent component.
(Inherited from Component)
_eventsEventRef[]Events that are attached to the current component, will be detached on unloading parent component.
(Inherited from Component)
_loadedbooleanWhether the component and its children are loaded.
(Inherited from Component)
allPropertiesBasesPropertyId[]All available properties from the dataset.
appAppReference to the app instance.
configBasesViewConfigThe config object for this view.
controllerBasesControllerThe controller for the view.
dataBasesQueryResultThe most recent output from executing the bases query, applying filters, and evaluating formulas. This object will be replaced with a new result set when changes to the vault or Bases config occur, so views should not keep a reference to it. Also note the contained obsidian#BasesEntry objects will be recreated.
lastDatastringThe last data of the view.
pluginBasesPluginInstanceBases plugin.
queryBasesQueryThe query for the view.
queryControllerQueryControllerThe query controller driving this view.
redoStackBasesViewTransaction[]The redo stack of transactions.
typestringThe type ID of this view
undoStackBasesViewTransaction[]The undo stack of transactions.

Methods

MethodReturnsDescription
addChild(component)TAdds a child component, loading it if this component is loaded.
(Inherited from Component)
copyToClipboard()voidCopies the current table to the clipboard (as TSV and Markdown).
createFileForView(baseFileName?, frontmatterProcessor?)Promise<void>Display the new note menu for a file with the provided filename and optionally a function to modify the frontmatter.
createGroupHeadingEl(group)HTMLElement | nullCreates the heading element for a result group.
createRenderer(property, el)unknownCreates a property-value renderer for a property within a container element.
createTransaction(callback)Promise<void>Runs a batch of property changes as one transaction that can be undone and redone.
exportTable()unknownBuilds an exportable representation of the current table.
focus()voidFocuses the view.
getEphemeralState()Record<string, unknown>Gets the view's ephemeral (non-persisted) state.
getViewActions()unknown[]Gets the view's toolbar actions.
getViewType()typeof ViewType.BasesGet view type.
load()voidLoad this component and its children.
(Inherited from Component)
onDataUpdated()voidCalled when there is new data for the query. This view should rerender with the updated data.
onLayoutChange()voidCalled when the layout of the view changes.
onload()voidOverride this to load your component.
(Inherited from Component)
onResize()voidHandles a resize of the view container.
onunload()voidOverride this to unload your component
(Inherited from Component)
onViewChanged()voidCalled when the view changes.
receiveSyncState(fileView)voidReceives the sync state.
redoTransaction()Promise<void>Redoes the most recently undone transaction.
register(cb)voidRegisters a callback to be called when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading.
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading
(Inherited from Component)
registerDomEvent(el, type, callback, options?)voidRegisters a DOM event to be detached when unloading
(Inherited from Component)
registerEvent(eventRef)voidRegisters an event to be detached when unloading.
(Inherited from Component)
registerInterval(id)numberRegisters an interval (from setInterval) to be cancelled when unloading. Use window.setInterval instead of setInterval to avoid TypeScript confusing between NodeJS vs Browser API
(Inherited from Component)
registerScopeEvent(keymapEventHandler)voidRegister a scope keymap event handler to be removed on unload.
(Inherited from Component)
removeChild(component)TRemoves a child component, unloading it.
(Inherited from Component)
saveQuery(query)voidSaves the query.
setEphemeralState(state)voidRestores the view's ephemeral state.
undoTransaction()Promise<void>Undoes the most recent transaction.
unload()voidOverride this to unload your component.
(Inherited from Component)
updateCurrentFile(file)voidUpdates the current file.
updateProperty(file, property, value)Promise<void>Updates a single frontmatter property on a file within a transaction.

Links to this page: