MultiRecordResource
A collection-oriented Resource: requests return an array and support pagination, filtering, sorting, and CRUD operations. It is suitable for "multiple records" scenarios such as tables and lists. Unlike APIResource, MultiRecordResource specifies the resource name via setResourceName(), automatically constructs URLs like users:list and users:create, and includes built-in capabilities for pagination, filtering, and row selection.
Inheritance: FlowResource → APIResource → BaseRecordResource → MultiRecordResource.
Creation: ctx.makeResource('MultiRecordResource') or ctx.initResource('MultiRecordResource'). Before use, you must call setResourceName('collectionName') (e.g., 'users'). In RunJS, ctx.api is injected by the runtime environment.
Use Cases
Data Format
getData()returns an array of records, which is thedatafield from the list API response.getMeta()returns pagination and other metadata:page,pageSize,count,totalPage, etc.
Resource Name and Data Source
Request Parameters (Filter / Fields / Sort)
Pagination
Selected Rows (Table Scenarios)
CRUD and List Operations
Configuration and Events
Examples
Basic List
Filtering and Sorting
Association Loading
Create and Pagination
Bulk Delete Selected Rows
Listening to the refresh Event
Association Resource (Sub-table)
Notes
- setResourceName is Required: You must call
setResourceName('collectionName')before use, otherwise the request URL cannot be constructed. - Association Resources: When the resource name is in the format
parent.child(e.g.,users.tags), you must callsetSourceId(parentPrimaryKey)first. - Refresh Debouncing: Multiple calls to
refresh()within the same event loop will only execute the last one to avoid redundant requests. - getData returns an Array: The
datareturned by the list API is an array of records, andgetData()returns this array directly.
Related
- ctx.resource - The resource instance in the current context
- ctx.initResource() - Initialize and bind to ctx.resource
- ctx.makeResource() - Create a new resource instance without binding
- APIResource - General API resource requested by URL
- SingleRecordResource - Oriented towards a single record

