Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 23d026f

Browse files
authored
Merge pull request #1384 from ghiscoding/chore/before-edit-cell
chore: cancel edit by calling `preventDefault()` w/`onBeforeEditCell`
2 parents 933955c + 2d36ac1 commit 23d026f

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

docs/column-functionalities/Editors.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ With that in mind and the code from the SO answer, we end up with the following
534534
#### Component
535535
```ts
536536
verifyCellIsEditableBeforeEditing(e, args): boolean {
537-
// your logic here should return true/false if it's editable or not
537+
// you can call `event.preventDefault()` to make cell not editable
538538
// args contains the dataContext and other Slickgrid arguments
539539
}
540540
```

docs/grid-functionalities/Composite-Editor-Modal.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,8 @@ handleOnBeforeEditCell(event) {
564564

565565
if (column && item) {
566566
if (!checkItemIsEditable(item, column, grid)) {
567-
event.preventDefault();
568-
eventData.stopImmediatePropagation();
567+
event.preventDefault(); // OR eventData.preventDefault();
568+
return false;
569569
}
570570
}
571571
return false;
@@ -600,8 +600,8 @@ handleOnBeforeEditCell(event) {
600600

601601
if (column && item) {
602602
if (!checkItemIsEditable(item, column, grid, target )) {
603-
event.preventDefault();
604-
eventData.stopImmediatePropagation();
603+
event.preventDefault(); // OR eventData.preventDefault();
604+
return false;
605605
}
606606
}
607607
return false;

src/app/examples/grid-composite-editor.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,7 +527,7 @@ export class GridCompositeEditorComponent implements OnDestroy, OnInit {
527527

528528
if (column && item) {
529529
if (!checkItemIsEditable(item, column, grid)) {
530-
e.stopImmediatePropagation();
530+
e.preventDefault(); // OR eventData.preventDefault();
531531
return false;
532532
}
533533
}

src/app/examples/grid-resize-by-content.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,8 @@ export class GridResizeByContentComponent implements OnInit {
427427

428428
if (column && item) {
429429
if (!checkItemIsEditable(item, column, grid)) {
430-
// event.preventDefault();
431-
e.stopImmediatePropagation();
430+
e.preventDefault(); // OR eventData.preventDefault();
431+
return false;
432432
}
433433
}
434434
return false;

0 commit comments

Comments
 (0)