Skip to content

Commit

Permalink
Merge pull request #75 from mikproto/master
Browse files Browse the repository at this point in the history
row index added
  • Loading branch information
revolist authored Oct 7, 2020
2 parents 8de3bc7 + c95ef00 commit c14745d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
8 changes: 4 additions & 4 deletions src/components/data/columnService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 7 additions & 1 deletion src/interfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c14745d

Please sign in to comment.