logologo
Get Started
Guide
Development
Plugins
API
Home
English
简体中文
日本語
한국어
Español
Português
Deutsch
Français
Русский
Italiano
Türkçe
Українська
Tiếng Việt
Bahasa Indonesia
ไทย
Polski
Nederlands
Čeština
العربية
עברית
हिन्दी
Svenska
Get Started
Guide
Development
Plugins
API
Home
logologo
RunJS Overview
Import Modules
Render in Container

Globals

window
document
navigator

ctx

ctx.blockModel
ctx.collection
ctx.collectionField
ctx.dataSource
ctx.dataSourceManager
ctx.element
ctx.exit()
ctx.exitAll()
ctx.filterManager
ctx.form
ctx.getModel()
ctx.getValue()
ctx.getVar()
ctx.i18n
ctx.importAsync()
ctx.initResource()
ctx.libs
ctx.location
ctx.logger
ctx.makeResource()
ctx.message
ctx.modal
ctx.model
ctx.notification
ctx.off()
ctx.on()
ctx.openView()
ctx.render()
ctx.request()
ctx.requireAsync()
ctx.resource
ctx.route
ctx.router
ctx.setValue()
ctx.sql
ctx.t()
ctx.view
Previous Pagectx.message
Next Pagectx.model

#ctx.modal

A shortcut API based on Ant Design Modal for opening modals from JSBlock / Action / JSField.

Implemented by ctx.viewer / the view system. Only common capabilities are listed here.

#Common usage

// Simple info modal
ctx.modal.info?.({
  title: 'Notice',
  content: 'The operation is complete',
});

// Confirm modal, can be combined with ctx.exit/ctx.exitAll
ctx.modal.confirm?.({
  title: 'Confirm delete',
  content: 'Are you sure you want to delete this record?',
  async onOk() {
    await ctx.runAction('destroy', { filterByTk: ctx.record?.id });
  },
});

Tips:

  • Method names and params are the same as Ant Design Modal (e.g. info, success, error, warning, confirm)
  • For complex interactions, use ctx.openView to open a custom view (page/drawer/modal). ctx.modal is better for lightweight prompts