Documentation
    Preparing search index...

    View Class

    Implements

    Index

    Constructors

    Properties

    attributes?: any
    configuration?: any
    default_render_page?: string
    description?: string
    exttable_name?: string
    id?: number
    min_role: number
    name: string
    singleton?: boolean
    slug?: any
    table_id?: number
    table_name?: string
    updated_at?: Date
    viewtemplate: string
    viewtemplateObj?: ViewTemplate

    Accessors

    Methods

    • Parameters

      • arg: { query: any; req: any; table_id: number }
      • remote: boolean = false

      Returns Promise<boolean>

      use authorize(user, { action: "get", ... }) instead. remote defaults to false here, not isRemoteTable().

    authorise_post

    • authorise_post(
          arg: { body: any; req: any; table_id: number },
          remote?: boolean,
      ): Promise<boolean>

      Parameters

      • arg: { body: any; req: any; table_id: number }
      • remote: boolean = false

      Returns Promise<boolean>

      use authorize(user, { action: "post", ... }) instead. remote defaults to false here, not isRemoteTable().

    • Full access decision: checks plugin authorize_view hooks and combines with min_role. A hook's explicit allow/deny always wins; only when every hook abstains does min_role decide. Proxied to the server on mobile for remote tables, so hooks never need to handle remote/local.

      Parameters

      • user: any

        the acting user (or undefined/public)

      • opts: {
            action: "get" | "post";
            body?: GenObj;
            remote?: boolean;
            req: any;
            route?: string;
            state?: GenObj;
        }
        • action: "get" | "post"

          "get" or "post"

        • Optionalbody?: GenObj

          POST body, for action "post"

        • Optionalremote?: boolean

          defaults to this.isRemoteTable()

        • req: any

          the request object, forwarded to hooks

        • Optionalroute?: string

          name of a specific viewtemplate custom route being invoked (ViewTemplate.routes key), if any

        • Optionalstate?: GenObj

          query/state, for action "get"

      Returns Promise<boolean>

    • emit a Real-time collaboration event for this view.

      Parameters

      • eventType: string

        event without view name (e.g. "DROP_EVENT")

      • data: any

        object you want to get in the event handler

      Returns void

    • get event name with view name in it (e.g. DROP_EVENT_my_kanban_view).

      Parameters

      • eventType: string

        event without view name (e.g. "DROP_EVENT")

      Returns string

      the full event name

    • saltcorn-mobile-app helper. True when this process has no local data access and must proxy queries to the server (mobile, online). False on the server, and false on mobile when offline. Not a per-table check despite the name.

      Returns boolean

      whether this view's queries must go over the network

    • Parameters

      • id: number | undefined
      • fieldName: string
      • fieldView: string
      • user: any
      • targetOpts: any

      Returns Promise<any>

    • Should we render on the local machine or get it from a server? In the normal web mode it's always the server but on mobile, we can render on the device as well

      Returns boolean

    • Parameters

      • query: any
      • req: Req
      • res: Res
      • remote: boolean = false
      • extra: any = {}

      Returns Promise<string | { goto?: string }>

    • Run many views with content filtered by query. Used in Search for example

      Parameters

      • query: GenObj

        this is query string

      • extraArgs: RunExtra
      • Optionalremote: boolean

      Returns Promise<string[] | { html: string; row: any }[]>