# Class View

View Class

#### Hierarchy

- View

#### Implements

- AbstractView

- Defined in saltcorn-data/models/view.ts:60
- Defined in saltcorn-data/models/view.ts:973

#####
Index

### Constructors

constructor

### Properties

attributes?
configuration?
default_render_page?
description?
exttable_name?
id?
min_role
name
singleton?
slug?
table?
table_id?
table_name?
viewtemplate
viewtemplateObj?

### Accessors

menu_label
select_option

### Methods

authorise_get
authorise_post
check_viewtemplate
clone
combine_state_and_default_state
connected_objects
delete
getStringsForI18n
getTags
get_config_flow
get_state_fields
inbound_connected_objects
interpolate_title_string
isRemoteTable
openDataStream
queries
rewrite_query_from_slug
run
runMany
runPost
runRoute
runServerSide
run_possibly_on_page
create
delete
find
findOne
find_all_views_where
find_possible_links_to_table
find_table_views_where
state_refresh
update

## Constructors

### constructor

- new View(o): View

- View constructor

  #### Parameters

  - ##### o: View | ViewCfg

  #### Returns View

  - Defined in saltcorn-data/models/view.ts:81

## Properties

### `Optional` attributes

attributes?: any

Implementation of AbstractView.attributes

- Defined in saltcorn-data/models/view.ts:72

### `Optional` configuration

configuration?: any

Implementation of AbstractView.configuration

- Defined in saltcorn-data/models/view.ts:71

### `Optional` default_render_page

default_render_page?: string

- Defined in saltcorn-data/models/view.ts:67

### `Optional` description

description?: string

- Defined in saltcorn-data/models/view.ts:69

### `Optional` exttable_name

exttable_name?: string

- Defined in saltcorn-data/models/view.ts:68

### `Optional` id

id?: number

Implementation of AbstractView.id

- Defined in saltcorn-data/models/view.ts:62

### min_role

min_role: number

Implementation of AbstractView.min_role

- Defined in saltcorn-data/models/view.ts:65

### name

name: string

Implementation of AbstractView.name

- Defined in saltcorn-data/models/view.ts:61

### `Optional` singleton

singleton?: boolean

- Defined in saltcorn-data/models/view.ts:74

### `Optional` slug

slug?: any

- Defined in saltcorn-data/models/view.ts:75

### `Optional` table

table?: AbstractTable

- Defined in saltcorn-data/models/view.ts:73

### `Optional` table_id

table_id?: number

- Defined in saltcorn-data/models/view.ts:63

### `Optional` table_name

table_name?: string

Implementation of AbstractView.table_name

- Defined in saltcorn-data/models/view.ts:70

### viewtemplate

viewtemplate: string

Implementation of AbstractView.viewtemplate

- Defined in saltcorn-data/models/view.ts:64

### `Optional` viewtemplateObj

viewtemplateObj?: ViewTemplate

- Defined in saltcorn-data/models/view.ts:66

## Accessors

### menu_label

- get menu_label(): undefined | string

- Get menu label

  #### Returns undefined | string

  - Defined in saltcorn-data/models/view.ts:202

### select_option

- get select_option(): any

- #### Returns any

  - Defined in saltcorn-data/models/view.ts:251

## Methods

### authorise_get

- authorise_get(arg, remote?): Promise<boolean>

- #### Parameters

  - ##### arg: {
    query: any;
    req: any;
    table_id: number;
    }

    - ##### query: any

    - ##### req: any

    - ##### table_id: number

  - ##### remote: boolean = false

  #### Returns Promise<boolean>

  - Defined in saltcorn-data/models/view.ts:438

### authorise_post

- authorise_post(arg, remote?): Promise<boolean>

- #### Parameters

  - ##### arg: {
    body: any;
    req: any;
    table_id: number;
    }

    - ##### body: any

    - ##### req: any

    - ##### table_id: number

  - ##### remote: boolean = false

  #### Returns Promise<boolean>

  - Defined in saltcorn-data/models/view.ts:404

### check_viewtemplate

- check_viewtemplate(): void

- #### Returns void

  #### Throws

  - Defined in saltcorn-data/models/view.ts:576

### clone

- clone(): Promise<View>

- Clone View

  #### Returns Promise<View>

  - Defined in saltcorn-data/models/view.ts:329

### combine_state_and_default_state

- combine_state_and_default_state(req_query): any

- #### Parameters

  - ##### req_query: any

  #### Returns any

  - Defined in saltcorn-data/models/view.ts:822

### connected_objects

- connected_objects(): Promise<ConnectedObjects>

- #### Returns Promise<ConnectedObjects>

  Implementation of AbstractView.connected_objects

  - Defined in saltcorn-data/models/view.ts:923

### delete

- delete(): Promise<void>

- Delete current view from db

  #### Returns Promise<void>

  - Defined in saltcorn-data/models/view.ts:352

### getStringsForI18n

- getStringsForI18n(): string[]

- #### Returns string[]

  - Defined in saltcorn-data/models/view.ts:456

### getTags

- getTags(): Promise<AbstractTag[]>

- #### Returns Promise<AbstractTag[]>

  Implementation of AbstractView.getTags

  - Defined in saltcorn-data/models/view.ts:957

### get_config_flow

- get_config_flow(req): Promise<Workflow>

- #### Parameters

  - ##### req: any

  #### Returns Promise<Workflow>

  - Defined in saltcorn-data/models/view.ts:845

### get_state_fields

- get_state_fields(): Promise<FieldLike[]>

- #### Returns Promise<FieldLike[]>

  - Defined in saltcorn-data/models/view.ts:179

### inbound_connected_objects

- inbound_connected_objects(): Promise<ConnectedObjects>

- #### Returns Promise<ConnectedObjects>

  - Defined in saltcorn-data/models/view.ts:904

### interpolate_title_string

- interpolate_title_string(title, query): Promise<string>

- #### Parameters

  - ##### title: string

  - ##### query: any

  #### Returns Promise<string>

  - Defined in saltcorn-data/models/view.ts:424

### isRemoteTable

- isRemoteTable(): boolean

- saltcorn-mobile-app helper. Check if the table of a view is local or server-side

  #### Returns boolean

  true if server-side table

  - Defined in saltcorn-data/models/view.ts:948

### openDataStream

- openDataStream(id, fieldName, fieldView, user, targetOpts): Promise<any>

- #### Parameters

  - ##### id: undefined | number

  - ##### fieldName: string

  - ##### fieldView: string

  - ##### user: any

  - ##### targetOpts: any

  #### Returns Promise<any>

  - Defined in saltcorn-data/models/view.ts:795

### queries

- queries(remote?, req?, res?): any

- #### Parameters

  - ##### `Optional` remote: boolean

  - ##### `Optional` req: Req

  - ##### `Optional` res: any

  #### Returns any

  - Defined in saltcorn-data/models/view.ts:517

### rewrite_query_from_slug

- rewrite_query_from_slug(query, params): void

- #### Parameters

  - ##### query: any

  - ##### params: any

  #### Returns void

  - Defined in saltcorn-data/models/view.ts:888

### run

- run(query, extraArgs, remote?): Promise<any>

- Run (Execute) View

  #### Parameters

  - ##### query: any

  - ##### extraArgs: RunExtra

  - ##### remote: boolean = ...

  #### Returns Promise<any>

  - Defined in saltcorn-data/models/view.ts:485

### runMany

- runMany(query, extraArgs, remote?): Promise<string[] | {
  html: string;
  row: any;
  }[]>

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

  #### Parameters

  - ##### query: GenObj

    this is query string

  - ##### extraArgs: RunExtra

  - ##### `Optional` remote: boolean

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

  #### Throws

  - Defined in saltcorn-data/models/view.ts:633

### runPost

- runPost(query, body, extraArgs, remote?): Promise<any>

- #### Parameters

  - ##### query: GenObj

  - ##### body: GenObj

  - ##### extraArgs: RunExtra

  - ##### remote: boolean = !isNode()

  #### Returns Promise<any>

  - Defined in saltcorn-data/models/view.ts:707

### runRoute

- runRoute(route, body, res, extraArgs, remote?): Promise<any>

- #### Parameters

  - ##### route: string

  - ##### body: any

  - ##### res: Res

  - ##### extraArgs: RunExtra

  - ##### remote: boolean = false

  #### Returns Promise<any>

  - Defined in saltcorn-data/models/view.ts:759

### runServerSide

- runServerSide(query): Promise<string>

- #### Parameters

  - ##### query: any

  #### Returns Promise<string>

  - Defined in saltcorn-data/models/view.ts:470

### run_possibly_on_page

- run_possibly_on_page(query, req, res, remote?, extra?): Promise<string | {
  goto?: string;
  }>

- #### Parameters

  - ##### query: any

  - ##### req: Req

  - ##### res: Res

  - ##### remote: boolean = false

  - ##### extra: any = {}

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

  - Defined in saltcorn-data/models/view.ts:590

### `Static` create

- create(v): Promise<View>

- Create view in database

  #### Parameters

  - ##### v: ViewCfg

  #### Returns Promise<View>

  - Defined in saltcorn-data/models/view.ts:310

### `Static` delete

- delete(where): Promise<void>

- Delete list of views

  #### Parameters

  - ##### where: Where

    condition

  #### Returns Promise<void>

  - Defined in saltcorn-data/models/view.ts:380

### `Static` find

- find(where?, selectopts?): Promise<View[]>

- #### Parameters

  - ##### `Optional` where: Where

  - ##### selectopts: SelectOptions = ...

  #### Returns Promise<View[]>

  - Defined in saltcorn-data/models/view.ts:136

### `Static` findOne

- findOne(where): undefined | View

- #### Parameters

  - ##### where: Where

  #### Returns undefined | View

  - Defined in saltcorn-data/models/view.ts:117

### `Static` find_all_views_where

- find_all_views_where(pred): Promise<View[]>

- #### Parameters

  - ##### pred: FindViewsPred

  #### Returns Promise<View[]>

  - Defined in saltcorn-data/models/view.ts:270

### `Static` find_possible_links_to_table

- find_possible_links_to_table(table): Promise<View[]>

- #### Parameters

  - ##### table: string | number | Tablely

  #### Returns Promise<View[]>

  - Defined in saltcorn-data/models/view.ts:294

### `Static` find_table_views_where

- find_table_views_where(table, pred): Promise<View[]>

- #### Parameters

  - ##### table: string | number | Tablely

  - ##### pred: FindViewsPred

  #### Returns Promise<View[]>

  - Defined in saltcorn-data/models/view.ts:214

### `Static` state_refresh

- state_refresh(): Promise<void>

- #### Returns Promise<void>

  - Defined in saltcorn-data/models/view.ts:194

### `Static` update

- update(v, id): Promise<void>

- Update View description

  #### Parameters

  - ##### v: any

    view name

  - ##### id: number

    id

  #### Returns Promise<void>

  - Defined in saltcorn-data/models/view.ts:391

Generated using TypeDoc