### Hierarchy

- SCTableModel

## Index

### Constructors

- constructor

### Properties

- _data
- _header
- _totalDataLength
- currentPage
- dataChange
- headerChange
- isEnd
- isLoading
- pageLength
- rowsClass
- rowsContext
- rowsExpanded
- rowsExpandedChange
- rowsSelected
- rowsSelectedChange
- selectAllChange
- tableModelCount
- COUNT

### Accessors

- data
- header
- totalDataLength

### Methods

- addColumn
- addRow
- column
- deleteColumn
- deleteRow
- expandRow
- expandedRowsCount
- getHeader
- getHeaderId
- getId
- getRowContext
- hasExpandableRows
- isRowDisabled
- isRowExpandable
- isRowExpanded
- isRowFiltered
- isRowSelected
- moveColumn
- popRowStateFromModelData
- pushRowStateToModelData
- realColumnIndex
- realIndex
- realRowIndex
- row
- selectAll
- selectRow
- selectedRowsCount
- sort

## Constructors

### constructor

- new SCTableModel(): SCTableModel

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:188

  #### Returns SCTableModel

## Properties

### Protected _data

_data: TableItem[][] = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:180

Used in `data`

### Protected _header

_header: TableHeaderItem[][] = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:182

### Protected _totalDataLength

_totalDataLength: number

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:144

Absolute total number of rows of the table.

### currentPage

currentPage: number = 1

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:124

Tracks the current page.

### dataChange

dataChange: EventEmitter<any> = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:13

### headerChange

headerChange: Subject<unknown> = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:12

### isEnd

isEnd: boolean = false

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:134

Set to true when there is no more data to load in the table

### isLoading

isLoading: boolean = false

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:139

Set to true when lazy loading to show loading indicator

### pageLength

pageLength: number = 10

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:129

Length of page.

### rowsClass

rowsClass: string[] = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:119

Contains class name(s) of the row.

It affects styling of the row to reflect the appended class name(s).

It's empty or undefined by default

### rowsContext

rowsContext: string[] = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:110

Contains information about the context of the row.

It affects styling of the row to reflect the context.

string can be one of `"success" | "warning" | "info" | "error" | ""` and it's empty or undefined by default

### rowsExpanded

rowsExpanded: boolean[] = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:100

Contains information about expanded state of rows in the table.

### rowsExpandedChange

rowsExpandedChange: EventEmitter<number> = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:15

### rowsSelected

rowsSelected: boolean[] = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:95

Contains information about selection state of rows in the table.

### rowsSelectedChange

rowsSelectedChange: EventEmitter<number> = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:14

### selectAllChange

selectAllChange: Subject<boolean> = ...

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:20

Gets emitted when `selectAll` is called. Emits false if all rows are deselected and true if all rows are selected.

### Protected tableModelCount

tableModelCount: number = 0

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:188

The number of models instantiated, this is to make sure each table has a different model count for unique id generation.

### Protected Static COUNT

COUNT: number = 0

- Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:10

The number of models instantiated, used for (among other things) unique id generation

## Accessors

### data

- get data(): TableItem[][]
- set data(newData: TableItem[][]): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:88

  Gets the full data.

  You can use it to alter individual `TableItem`s but if you need to change table structure, use `addRow()` and/or `addColumn()`

  #### Returns TableItem[][]

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:46

  Sets data of the table.

  Make sure all rows are the same length to keep the column count accurate.

  #### Parameters

  - ##### newData: TableItem[][]

  #### Returns void

### header

- get header(): any
- set header(newHeader: any): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:37

  Contains information about the header cells of the table.

  #### Returns any

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:25

  Contains information about the header cells of the table.

  #### Parameters

  - ##### newHeader: any

  #### Returns void

### totalDataLength

- get totalDataLength(): number
- set totalDataLength(length: number): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:163

  Total length of data that table has access to, or the amount manually set

  Example: if you have multiple pages of data that table will display but you're loading one at a time.

  Set to `null` to reset to default behavior.

  #### Returns number

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:155

  Manually set data length in case the data in the table doesn't correctly reflect all the data that table is to display.

  Example: if you have multiple pages of data that table will display but you're loading one at a time.

  Set to `null` to reset to default behavior.

  #### Parameters

  - ##### length: number

  #### Returns void

## Methods

### addColumn

- addColumn(column?: TableItem[], index?: number): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:459

  Adds a column to the `index`th column or appends to table if index not provided.

  If column is shorter than other columns or not provided, it will be padded with empty `TableItem` elements.

  If column is longer than other columns, others will be extended to match so no data is lost.

  If called on an empty table with no parameters, it creates a 1x1 table.

  Negative index starts from the end. -1 being the last element.

  #### Parameters

  - ##### Optional column: TableItem[]

  - ##### Optional index: number

  #### Returns void

### addRow

- addRow(row?: TableItem[], index?: number): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:314

  Adds a row to the `index`th row or appends to table if index not provided.

  If row is shorter than other rows or not provided, it will be padded with empty `TableItem` elements.

  If row is longer than other rows, others will be extended to match so no data is lost.

  If called on an empty table with no parameters, it creates a 1x1 table.

  Negative index starts from the end. -1 being the last element.

  #### Parameters

  - ##### Optional row: TableItem[]

  - ##### Optional index: number

  #### Returns void

### column

- column(index: number): TableItem[]

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:431

  Returns `index`th column of the table.

  Negative index starts from the end. -1 being the last element.

  #### Parameters

  - ##### index: number

  #### Returns TableItem[]

### deleteColumn

- deleteColumn(index: number): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:520

  Deletes `index`th column.

  Negative index starts from the end. -1 being the last element.

  #### Parameters

  - ##### index: number

  #### Returns void

### deleteRow

- deleteRow(index: number): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:397

  Deletes `index`th row.

  Negative index starts from the end. -1 being the last element.

  #### Parameters

  - ##### index: number

  #### Returns void

### expandRow

- expandRow(index: number, value?: boolean): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:658

  Expands/Collapses `index`th row based on value

  #### Parameters

  - ##### index: number

    index of the row to expand or collapse

  - ##### value: boolean = true

    expanded state of the row. `true` is expanded and `false` is collapsed

  #### Returns void

### expandedRowsCount

- expandedRowsCount(): number

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:276

  Returns how many rows is currently expanded

  #### Returns number

### getHeader

- getHeader(column: any): any

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:235

  Finds closest header by trying the lowest cell in header and then work its way to the left

  #### Parameters

  - ##### column: any

  #### Returns any

### getHeaderId

- getHeaderId(column: HeaderType, colSpan?: number): string

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:211

  #### Parameters

  - ##### column: HeaderType

  - ##### colSpan: number = 1

  #### Returns string

### getId

- getId(column: HeaderType, row?: number): string

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:207

  Returns an id for the given column

  #### Parameters

  - ##### column: HeaderType

    the column to generate an id for

  - ##### row: number = 0

    the row of the header to generate an id for

  #### Returns string

### getRowContext

- getRowContext(index: number): string

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:420

  #### Parameters

  - ##### index: number

  #### Returns string

### hasExpandableRows

- hasExpandableRows(): boolean

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:408

  #### Returns boolean

### isRowDisabled

- isRowDisabled(index: number): boolean

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:647

  Checks if row is disabled or not.

  #### Parameters

  - ##### index: number

  #### Returns boolean

### isRowExpandable

- isRowExpandable(index: number): boolean

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:412

  #### Parameters

  - ##### index: number

  #### Returns boolean

### isRowExpanded

- isRowExpanded(index: number): boolean

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:416

  #### Parameters

  - ##### index: number

  #### Returns boolean

### isRowFiltered

- isRowFiltered(index: number): boolean

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:194

  #### Parameters

  - ##### index: number

  #### Returns boolean

### isRowSelected

- isRowSelected(index: number): boolean

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:640

  #### Parameters

  - ##### index: number

  #### Returns boolean

### moveColumn

- moveColumn(indexFrom: number, indexTo: number): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:534

  #### Parameters

  - ##### indexFrom: number

  - ##### indexTo: number

  #### Returns void

### popRowStateFromModelData

- popRowStateFromModelData(): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:603

  Restores `rowsSelected` from data pushed by `pushRowSelectionToModelData()`

  Call after sorting data (if you previously pushed to maintain selection order) to make everything right with the world again.

  #### Returns void

### pushRowStateToModelData

- pushRowStateToModelData(): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:577

  Appends `rowsSelected` and `rowsExpanded` info to model data.

  When sorting rows, do this first so information about row selection gets sorted with the other row info.

  Call `popRowSelectionFromModelData()` after sorting to make everything right with the world again.

  #### Returns void

### Protected realColumnIndex

- realColumnIndex(index: number): number

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:681

  Gets the true index of a column based on it's relative position. Like in Python, positive numbers start from the top and negative numbers start from the bottom.

  #### Parameters

  - ##### index: number

  #### Returns number

### Protected realIndex

- realIndex(index: number, length: number): number

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:692

  Generic function to calculate the real index of something. Used by `realRowIndex()` and `realColumnIndex()`

  #### Parameters

  - ##### index: number

  - ##### length: number

  #### Returns number

### Protected realRowIndex

- realRowIndex(index: number): number

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:670

  Gets the true index of a row based on it's relative position. Like in Python, positive numbers start from the top and negative numbers start from the bottom.

  #### Parameters

  - ##### index: number

  #### Returns number

### row

- row(index: number): TableItem[]

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:295

  Returns `index`th row of the table.

  Negative index starts from the end. -1 being the last element.

  #### Parameters

  - ##### index: number

  #### Returns TableItem[]

### selectAll

- selectAll(value?: boolean): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:631

  Selects or deselects all rows in the model

  #### Parameters

  - ##### value: boolean = true

    state to set all rows to. Defaults to `true`

  #### Returns void

### selectRow

- selectRow(index: number, value?: boolean): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:618

  Select/deselect `index`th row based on value

  #### Parameters

  - ##### index: number

    index of the row to select

  - ##### value: boolean = true

    state to set the row to. Defaults to `true`

  #### Returns void

### selectedRowsCount

- selectedRowsCount(): number

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:261

  Returns how many rows is currently selected

  #### Returns number

### sort

- sort(index: number): void

- - Defined in packages/angular/src/toolkit/table/sterling-table-model.class.ts:551

  Sorts the data currently present in the model based on `compare()`

  Direction is set by `ascending` and `descending` properties of `TableHeaderItem` in `index`th column.

  #### Parameters

  - ##### index: number

    The column based on which it's sorting

  #### Returns void

Generated using TypeDoc