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.requireAsync()
Next Pagectx.route

#ctx.resource

The resource instance (FlowResource) in the current context, used to access and operate on data.

  • It may be pre-bound by the block/modal runtime.
  • If no resource exists in the context, call ctx.initResource(type) first, then use ctx.resource.

Common usage:

// Ensure resource exists (create by type if needed)
ctx.initResource('MultiRecordResource');
ctx.resource.setResourceName('users');
await ctx.resource.refresh();
const rows = ctx.resource.getData();

Common methods (depend on resource type): getData(), setData(value), refresh(), setResourceName(name), setFilterByTk(tk), runAction(actionName, params), and on/off event subscriptions.

See detailed APIs for each Resource type:

  • MultiRecordResource - multiple records / list
  • SingleRecordResource - single record
  • APIResource - generic API resource
  • SQLResource - SQL query resource