← DataGrid API

Interface · v2.7.1

NgbDatagridEditService

Edit workflow contract used by the grid for create, update, delete, save, and cancel handling.

Import

import type { NgbDatagridEditService } from '@angular-bootstrap/ngbootstrap';

Declaration

Methods

create

Create a new row in the provided data set. Implementations may mark the row as "new" until `saveChanges` is called.

create(data: readonly T[], newRow: T, rowIndex: number, rowId: NgbDatagridRowId): T[]

update

Update an existing row in the provided data set. Implementations may snapshot the original row to support `cancelChanges` and `hasChanges`.

update(data: readonly T[], updatedRow: T, rowIndex: number, rowId: NgbDatagridRowId): T[]

remove

Remove a row from the provided data set.

remove(data: readonly T[], rowIndex: number, rowId: NgbDatagridRowId): T[]

assignValues

Used by the datagrid while editing to compute a new row instance. Default behavior is a shallow merge of the values into the row.

assignValues(row: T, values: Partial<T>): T

isNew

Whether this row is considered newly created (not yet saved).

isNew(rowId: NgbDatagridRowId): boolean

hasChanges

Whether the row differs from its captured baseline (after `update`/`create` starts tracking).

hasChanges(rowId: NgbDatagridRowId, currentRow: T): boolean

saveChanges

Commit current changes (and clear tracking state) for the row.

saveChanges(data: readonly T[], rowIndex: number, rowId: NgbDatagridRowId, currentRow: T): T[]

cancelChanges

Revert tracked changes for the row (or remove it if it was new).

cancelChanges(data: readonly T[], rowIndex: number, rowId: NgbDatagridRowId): T[]

Referenced types

Source: src/datagrid/src/services/editing.service.ts in the installed @angular-bootstrap/ngbootstrap package. Angular compiler metadata and private members are omitted.

This project is not affiliated with ng-bootstrap or ngx-bootstrap. Those projects focus mainly on Bootstrap components for Angular. ngbootstrap focuses on Angular UI for data-heavy apps, especially Data Grid, Angular-native Form Builder, drag and drop workflows, documentation examples, and performance-focused Angular patterns.