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
interface NgbDatagridEditService<T>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>): TisNew
Whether this row is considered newly created (not yet saved).
isNew(rowId: NgbDatagridRowId): booleanhasChanges
Whether the row differs from its captured baseline (after `update`/`create` starts tracking).
hasChanges(rowId: NgbDatagridRowId, currentRow: T): booleansaveChanges
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[]