[**@rxap/material-table-system v19.0.2-dev.1**](../README.md)

***

[@rxap/material-table-system](../globals.md) / SelectionModel

# Class: SelectionModel\<T\>

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:16](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L16)

Class to be used to power selecting one or more options from a list.

## Type Parameters

• **T**

## Constructors

### new SelectionModel()

> **new SelectionModel**\<`T`\>(`_multiple`, `initiallySelectedValues`?, `_emitChanges`?, `compareWith`?): [`SelectionModel`](SelectionModel.md)\<`T`\>

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:41](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L41)

#### Parameters

##### \_multiple

`boolean` = `false`

##### initiallySelectedValues?

`T`[]

##### \_emitChanges?

`boolean` = `true`

##### compareWith?

(`o1`, `o2`) => `boolean`

#### Returns

[`SelectionModel`](SelectionModel.md)\<`T`\>

## Properties

### changed

> `readonly` **changed**: `Subject`\<[`SelectionChange`](../interfaces/SelectionChange.md)\<`T`\>\>

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:39](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L39)

Event emitted when the value has changed.

***

### compareWith()?

> `optional` **compareWith**: (`o1`, `o2`) => `boolean`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:45](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L45)

#### Parameters

##### o1

`T`

##### o2

`T`

#### Returns

`boolean`

## Accessors

### selected

#### Get Signature

> **get** **selected**(): `T`[]

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:30](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L30)

Selected values.

##### Returns

`T`[]

## Methods

### clear()

> **clear**(`flushEvent`): `boolean` \| `void`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:123](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L123)

Clears all of the selected values.

#### Parameters

##### flushEvent

`boolean` = `true`

Whether to flush the changes in an event.
  If false, the changes to the selection will be flushed along with the next event.

#### Returns

`boolean` \| `void`

Whether the selection changed as a result of this call
@breaking-change 16.0.0 make return type boolean

***

### deselect()

> **deselect**(...`values`): `boolean` \| `void`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:79](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L79)

Deselects a value or an array of values.

#### Parameters

##### values

...`T`[]

The values to deselect

#### Returns

`boolean` \| `void`

Whether the selection changed as a result of this call
@breaking-change 16.0.0 make return type boolean

***

### hasValue()

> **hasValue**(): `boolean`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:157](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L157)

Determines whether the model has a value.

#### Returns

`boolean`

***

### isEmpty()

> **isEmpty**(): `boolean`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:150](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L150)

Determines whether the model does not have a value.

#### Returns

`boolean`

***

### isMultipleSelection()

> **isMultipleSelection**(): `boolean`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:173](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L173)

Gets whether multiple values can be selected.

#### Returns

`boolean`

***

### isSelected()

> **isSelected**(`value`): `boolean`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:135](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L135)

Determines whether a value is selected.

#### Parameters

##### value

`T`

#### Returns

`boolean`

***

### select()

> **select**(...`values`): `boolean` \| `void`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:65](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L65)

Selects a value or an array of values.

#### Parameters

##### values

...`T`[]

The values to select

#### Returns

`boolean` \| `void`

Whether the selection changed as a result of this call
@breaking-change 16.0.0 make return type boolean

***

### setSelection()

> **setSelection**(...`values`): `boolean` \| `void`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:93](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L93)

Sets the selected values

#### Parameters

##### values

...`T`[]

The new selected values

#### Returns

`boolean` \| `void`

Whether the selection changed as a result of this call
@breaking-change 16.0.0 make return type boolean

***

### sort()

> **sort**(`predicate`?): `void`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:164](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L164)

Sorts the selected values based on a predicate function.

#### Parameters

##### predicate?

(`a`, `b`) => `number`

#### Returns

`void`

***

### toggle()

> **toggle**(`value`): `boolean` \| `void`

Defined in: [packages/angular/material/table-system/src/lib/select-row/selection-model.ts:112](https://gitlab.com/rxap/packages/-/blob/8058138ff98d9e37b711846892c79ebc45ed17d4/packages/angular/material/table-system/src/lib/select-row/selection-model.ts#L112)

Toggles a value between selected and deselected.

#### Parameters

##### value

`T`

The value to toggle

#### Returns

`boolean` \| `void`

Whether the selection changed as a result of this call
@breaking-change 16.0.0 make return type boolean
