From e3fdeade6813a7dfddb96f112935c44daa5f0536 Mon Sep 17 00:00:00 2001 From: volkanceylan Date: Thu, 5 Sep 2024 14:04:03 +0300 Subject: [PATCH] Add a itemId function that returns id property value of the given item --- packages/corelib/dist/index.d.ts | 1 + packages/corelib/src/ui/datagrid/datagrid.ts | 4 ++++ packages/corelib/wwwroot/index.global.d.ts | 1 + 3 files changed, 6 insertions(+) diff --git a/packages/corelib/dist/index.d.ts b/packages/corelib/dist/index.d.ts index 50fe4ba468..79e62eb32a 100644 --- a/packages/corelib/dist/index.d.ts +++ b/packages/corelib/dist/index.d.ts @@ -5215,6 +5215,7 @@ declare class DataGrid extends Widget

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; diff --git a/packages/corelib/src/ui/datagrid/datagrid.ts b/packages/corelib/src/ui/datagrid/datagrid.ts index 866aabe87e..180990180f 100644 --- a/packages/corelib/src/ui/datagrid/datagrid.ts +++ b/packages/corelib/src/ui/datagrid/datagrid.ts @@ -507,6 +507,10 @@ export class DataGrid extends Widget

implements IDataGrid, IRe return this.slickGrid.getDataItem(row); } + itemId(item: TItem): any { + return (item as any)[this.getIdProperty()]; + } + rowCount() { return this.slickGrid.getDataLength(); } diff --git a/packages/corelib/wwwroot/index.global.d.ts b/packages/corelib/wwwroot/index.global.d.ts index dec70d310d..678cca9a78 100644 --- a/packages/corelib/wwwroot/index.global.d.ts +++ b/packages/corelib/wwwroot/index.global.d.ts @@ -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;