Forest Admin - API reference
    Preparing search index...

    Class ActionContext<S, N>

    Type Parameters

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    filter: TFilter<S, N>
    formValues: RecordData
    hasFieldChanged: (fieldName: string) => boolean
    realCollection: Collection

    Accessors

    • get caller(): Readonly<Caller>

      Returns Readonly<Caller>

    • get changedField(): string

      Returns string

      use hasFieldChange instead. linked issue.

      remove accessor

    • get collection(): RelaxedCollection<S, N>

      Returns RelaxedCollection<S, N>

    • get dataSource(): RelaxedDataSource<S>

      Returns RelaxedDataSource<S>

    Methods

    • Parameters

      • records: any

      Returns void

    • Get all the records ids (when the collection uses composite keys)

      Returns Promise<CompositeId[]>

    • Get all the records ids selected by an action

      Returns Promise<(string | number)[]>

    • Get all the records selected by an action

      Parameters

      • fields: TFieldName<S, N>[]

        An array of fields needed in the response

      Returns Promise<TRow<S, N>[]>

      .getRecords(['id', 'isActive', 'name']);
      
    • Stop hooks execution and send error to the UI

      Parameters

      • message: string

        the error message

      Returns never

      .throwError('My error message');
      
    • Stop hooks execution and send Forbidden error to the UI

      Parameters

      • message: string

        the forbidden error message

      Returns never

      .throwForbiddenError('My forbidden error message');
      
    • Stop hooks execution and send Validation error to the UI

      Parameters

      • message: string

        the validation error message

      Returns never

      .throwValidationError('My validation error message');