Skip to content

Commit

Permalink
Allow column.editable: false to disable editing even if we have a cus…
Browse files Browse the repository at this point in the history
…tom editor
  • Loading branch information
nstepien committed Apr 22, 2020
1 parent 5d906bd commit f7112c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/utils/columnUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe('canEdit', () => {
expect(canEdit({ ...column, editable: false }, row)).toBe(false);
expect(canEdit({ ...column, editable: true }, row)).toBe(true);
expect(canEdit({ ...column, editor }, row)).toBe(true);
expect(canEdit({ ...column, editor, editable: false }, row)).toBe(true);
expect(canEdit({ ...column, editor, editable: false }, row)).toBe(false);
expect(canEdit({ ...column, editor, editable: true }, row)).toBe(true);
});
});
2 changes: 1 addition & 1 deletion src/utils/columnUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export function canEdit<R, SR>(column: CalculatedColumn<R, SR>, row: R): boolean
if (typeof column.editable === 'function') {
return column.editable(row);
}
return Boolean(column.editor || column.editable);
return column.editable || column.editor != null && column.editable !== false;
}

export function getColumnScrollPosition<R, SR>(columns: readonly CalculatedColumn<R, SR>[], idx: number, currentScrollLeft: number, currentClientWidth: number): number {
Expand Down

0 comments on commit f7112c6

Please sign in to comment.