From c95ef0092a7ad346b88a91fde20e902ae6a3eebd Mon Sep 17 00:00:00 2001 From: mikproto Date: Wed, 7 Oct 2020 19:03:31 +0300 Subject: [PATCH] row index added --- package.json | 2 +- src/components/data/columnService.ts | 8 ++++---- src/interfaces.d.ts | 8 +++++++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 78919312..2e92013a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@revolist/revogrid", - "version": "1.6.12", + "version": "1.6.13", "description": "Virtual reactive data grid component - RevoGrid.", "license": "MIT", "bugs": { diff --git a/src/components/data/columnService.ts b/src/components/data/columnService.ts index f26a6a59..7f095d78 100644 --- a/src/components/data/columnService.ts +++ b/src/components/data/columnService.ts @@ -112,16 +112,16 @@ export default class ColumnService implements ColumnServiceI { return this.columns[c]?.editor; } - rowDataModel(r: number, c: number): ColumnDataSchemaModel { + rowDataModel(rowIndex: number, c: number): ColumnDataSchemaModel { const column = this.columns[c]; const prop: ColumnProp | undefined = column?.prop; const data: DataSource = this.dataStore.get('items'); - if (!data[r]) { + if (!data[rowIndex]) { console.error('unexpected count'); } - const model: DataType = data[r] || {}; - return {prop, model, data, column}; + const model: DataType = data[rowIndex] || {}; + return {prop, model, data, column, rowIndex}; } getRangeData(d: Selection.ChangedRange): RevoGrid.DataLookup { diff --git a/src/interfaces.d.ts b/src/interfaces.d.ts index 62c85f34..c107cd36 100644 --- a/src/interfaces.d.ts +++ b/src/interfaces.d.ts @@ -29,10 +29,16 @@ export declare namespace RevoGrid { // -------------------------------------------------------------------------- type ColumnDataSchemaModel = { + // property prop: ColumnProp; + // row model model: DataType; - data: DataSource; + // column data column: ColumnRegular; + // index in grid datasource + rowIndex: number; + // grid datasource + data: DataSource; }; type ReadOnlyFormat = boolean | ((params: ColumnDataSchemaModel) => boolean);