Skip to content

Commit

Permalink
fix: loop on boolean edit when read only (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
matttdawson authored Sep 24, 2024
1 parent df0c29a commit ae0bca6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/components/clickInputWhenContainingCellClicked.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { CellClickedEvent } from "ag-grid-community";
import { fnOrVar } from "../utils/util";

/**
* AgGrid checkbox select does not pass clicks within cell but not on the checkbox to checkbox.
Expand All @@ -9,13 +8,14 @@ export const clickInputWhenContainingCellClicked = (params: CellClickedEvent) =>
const { data, event, colDef } = params;
if (!data || !event) return;

if (fnOrVar(colDef.editable, params) === false) {
return;
}

const element = event.target as Element;
// Already handled
if (["BUTTON", "INPUT"].includes(element?.tagName) && element.closest(".ag-cell-inline-editing")) return;
if (
element.closest(".GridCell-readonly") ||
(["BUTTON", "INPUT"].includes(element?.tagName) && element.closest(".ag-cell-inline-editing"))
) {
return;
}

const row = element.closest("[row-id]");
if (!row) return;
Expand Down

0 comments on commit ae0bca6

Please sign in to comment.