# Class PageGroup

PageGroup class This is a collection of pages that can be requested like a normal page. Each member of the group has an eligibility formula, and the first page whose eligibility formula matches is shown. This can be used to show different pages on different devices.

#### Implements

- AbstractPageGroup

- Defined in packages/saltcorn-data/models/page_group.ts:25
- Defined in packages/saltcorn-data/models/page_group.ts:343

##### Index

### Constructors

constructor

### Properties

description?
id?
members
min_role
name
random_allocation

### Methods

addMember
clearMembers
clone
connected_objects
delete
findMember
getEligiblePage
loadPages
moveMember
removeMember
sortedMembers
create
delete
find
findOne
update

## Constructors

### constructor

- new PageGroup(cfg: PageGroupCfg): PageGroup

  #### Parameters

  - cfg: PageGroupCfg

  #### Returns PageGroup

  - Defined in packages/saltcorn-data/models/page_group.ts:32

## Properties

### `Optional` description

description?: string

Implementation of AbstractPageGroup.description

- Defined in packages/saltcorn-data/models/page_group.ts:28

### `Optional` id

id?: number

Implementation of AbstractPageGroup.id

- Defined in packages/saltcorn-data/models/page_group.ts:26

### members

members: AbstractPageGroupMember[]

Implementation of AbstractPageGroup.members

- Defined in packages/saltcorn-data/models/page_group.ts:29

### min_role

min_role: number

Implementation of AbstractPageGroup.min_role

- Defined in packages/saltcorn-data/models/page_group.ts:30

### name

name: string

Implementation of AbstractPageGroup.name

- Defined in packages/saltcorn-data/models/page_group.ts:27

### random_allocation

random_allocation: boolean

Implementation of AbstractPageGroup.random_allocation

- Defined in packages/saltcorn-data/models/page_group.ts:31

## Methods

### addMember

- addMember(cfg: PageGroupMemberCfg): Promise<PageGroupMember>

  add a member to this group

  #### Parameters

  - cfg: PageGroupMemberCfg

  #### Returns Promise<PageGroupMember>

  - Defined in packages/saltcorn-data/models/page_group.ts:285

### clearMembers

- clearMembers(): Promise<void>

  clear all members from this group

  #### Returns Promise<void>

  - Defined in packages/saltcorn-data/models/page_group.ts:310

### clone

- clone(): Promise<PageGroup>

  duplicate this group with a new name

  #### Returns Promise<PageGroup>

  the created group

  - Defined in packages/saltcorn-data/models/page_group.ts:261

### connected_objects

- connected_objects(): ConnectedObjects

  #### Returns ConnectedObjects

  - Defined in packages/saltcorn-data/models/page_group.ts:337

### delete

- delete(): Promise<void>

  delete this group

  #### Returns Promise<void>

  - Defined in packages/saltcorn-data/models/page_group.ts:252

### findMember

- findMember(where: any): AbstractPageGroupMember[]

  find a member

  #### Parameters

  - where: any

  #### Returns AbstractPageGroupMember[]

  - Defined in packages/saltcorn-data/models/page_group.ts:332

### getEligiblePage

- getEligiblePage(
  data: ScreenInfoParams,
  user: any,
  locale?: string,
  ): Promise<Page | null>

  determine the first page in the group that matches the client screen size

  #### Parameters

  - data: ScreenInfoParams

    client screen and window size

  - user: any

    the user or just { role_id: 100 }

  - `Optional` locale: string

  #### Returns Promise<Page | null>

  the matching page, or null

  - Defined in packages/saltcorn-data/models/page_group.ts:50

### loadPages

- loadPages(): Promise<Page[]>

  #### Returns Promise<Page[]>

  - Defined in packages/saltcorn-data/models/page_group.ts:118

### moveMember

- moveMember(member: AbstractPageGroupMember, mode: "Up" | "Down"): Promise<void>

  manipulate the sequence of a member

  #### Parameters

  - member: AbstractPageGroupMember
  - mode: "Up" | "Down"

  #### Returns Promise<void>

  - Defined in packages/saltcorn-data/models/page_group.ts:91

### removeMember

- removeMember(id: number): Promise<void>

  remove a member from this group

  #### Parameters

  - id: number

    id of the member

  #### Returns Promise<void>

  - Defined in packages/saltcorn-data/models/page_group.ts:321

### sortedMembers

- sortedMembers(): AbstractPageGroupMember[]

  #### Returns AbstractPageGroupMember[]

  the members sorted by sequence

  - Defined in packages/saltcorn-data/models/page_group.ts:114

### `Static` create

- create(cfg: PageGroupCfg): Promise<PageGroup>

  create a new group and add members

  #### Parameters

  - cfg: PageGroupCfg

  #### Returns Promise<PageGroup>

  the created group

  - Defined in packages/saltcorn-data/models/page_group.ts:187

### `Static` delete

- delete(where: number | Where): Promise<void>

  delete a group

  #### Parameters

  - where: number | Where

  #### Returns Promise<void>

  - Defined in packages/saltcorn-data/models/page_group.ts:223

### `Static` find

- find(where?: Where, selectopts?: SelectOptions): Promise<PageGroup[]>

  find groups

  #### Parameters

  - `Optional` where: Where
  - selectopts: SelectOptions = ...

  #### Returns Promise<PageGroup[]>

  an array of page groups

  - Defined in packages/saltcorn-data/models/page_group.ts:132

### `Static` findOne

- findOne(where: Where): PageGroup | null

  find one group

  #### Parameters

  - where: Where

  #### Returns PageGroup | null

  one page group or null

  - Defined in packages/saltcorn-data/models/page_group.ts:170

### `Static` update

- update(id: number, row: Row): Promise<void>

  update a group

  #### Parameters

  - id: number

    id of the group

  - row: Row

    values to update

  #### Returns Promise<void>

  - Defined in packages/saltcorn-data/models/page_group.ts:213