Skip to content

Commit

Permalink
Add a itemId function that returns id property value of the given item
Browse files Browse the repository at this point in the history
  • Loading branch information
volkanceylan committed Sep 5, 2024
1 parent f474fa5 commit e3fdead
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/corelib/dist/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5215,6 +5215,7 @@ declare class DataGrid<TItem, P = {}> extends Widget<P> implements IDataGrid, IR
protected createSlickGrid(): Grid;
protected setInitialSortOrder(): void;
itemAt(row: number): TItem;
itemId(item: TItem): any;
rowCount(): number;
getItems(): TItem[];
setItems(value: TItem[]): void;
Expand Down
4 changes: 4 additions & 0 deletions packages/corelib/src/ui/datagrid/datagrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,10 @@ export class DataGrid<TItem, P = {}> extends Widget<P> implements IDataGrid, IRe
return this.slickGrid.getDataItem(row);
}

itemId(item: TItem): any {
return (item as any)[this.getIdProperty()];
}

rowCount() {
return this.slickGrid.getDataLength();
}
Expand Down
1 change: 1 addition & 0 deletions packages/corelib/wwwroot/index.global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6766,6 +6766,7 @@ declare namespace Serenity {
protected createSlickGrid(): Slick.Grid;
protected setInitialSortOrder(): void;
itemAt(row: number): TItem;
itemId(item: TItem): any;
rowCount(): number;
getItems(): TItem[];
setItems(value: TItem[]): void;
Expand Down

0 comments on commit e3fdead

Please sign in to comment.