Skip to main content

Client-side API

The ComindView global is the main entry point for client-side logic. It is available inside views/logic/index.ts and is typed in api/typings/cmw-client.ts. For usage patterns and examples, see View logic. For server-side equivalents, see Server-side API.

Properties

PropertyTypePurpose
ComindView.actionstringCurrent action name (e.g. 'add', 'edit')
ComindView.actionModestringForm mode - 'mass-edit', 'editable', 'editing', 'full-form', 'plain-with-comment', 'plain'
ComindView.workspaceobjectCurrent workspace context with .alias, .current_user_id, .group_participants, .tabs
ComindView.schemaobjectLoaded app schema - fields, actions, lookups, publishing_alias
ComindView.currentUserobjectUser info - .id, .email, .isWorkspaceAdmin, .isGlobalAdmin, .isInGroup(name)

ViewLogic methods

These methods are defined in your views/logic/index.ts export. See View logic for the export pattern and detailed examples.

Lifecycle hooks:

MethodPurpose
onReady()Form loaded and ready
onRefresh()Form data refreshed
onDestroy()Form being destroyed
onReset()Form reset
onBeforeSave()Pre-save validation - return false or an error string to block save
onGridLoaded()Embedded grid finished loading
onInputChange()Field value changed

Dynamic field control:

MethodPurpose
getInvisibleFields()Return field names to hide
getRequiredFields()Return field names to make required
getReadonlyFields()Return field names to make read-only
getFilterKeys()Filter keys for lookups
getFieldOverrides()Override field schema properties dynamically
helperFunction()Register helper functions

Record navigation

Methods for traversing the record hierarchy. Parent, child, and sibling accessors return data synchronously from the already-loaded context. The async methods fetch records on demand.

MethodPurpose
ComindView.parentRecord(fieldName?)Access parent record data
ComindView.childRecords(appAlias?, fieldName?)Access child records
ComindView.siblingRecords()Access sibling records
ComindView.getLinkedRecordAsync(fieldName)Async fetch of a linked record
ComindView.getRecordById(id)Async fetch any record by ID

Settings and variables

MethodPurpose
ComindView.getVars()Get app variables (workspace-level, set by admin)
ComindView.getSetting(name)Get an app setting value

Grid methods

Methods for working with embedded child grids.

MethodPurpose
ComindView.addGridRow(values, appAlias?, fieldName?)Programmatically add a row to an embedded grid

Requests

MethodPurpose
ComindView.request(url, config?)HTTP request from the browser

UI utilities

MethodPurpose
ComindView.uiUtils.getFgHexColorByBg()Get foreground color for a given background
ComindView.uiUtils.safeDigest()Safely trigger Angular digest cycle
ComindView.uiUtils.setTabCounter()Set a counter badge on a tab
  • View logic - developer patterns for using these methods in views/logic/index.ts
  • Actions - server-side action definitions that complement client-side hooks
  • Fields - field db names, types, and the options catalog
  • Server-side API - global variables and functions available in server-side logic