feat(grid): add set NULL context menu action
This commit is contained in:
1 parent
10827f105a
commit
669f3a4914
4 files changed
+153
-1
No files matched your search
@@ -7046,6 +7046,11 @@ function selectionHasEditableCells(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
function setSelectionNull() {
|
||||
if (!props.editable || !selectionHasEditableCells()) return;
|
||||
fillSelectionWithValue(null);
|
||||
}
|
||||
|
||||
function openBulkEditDialog() {
|
||||
if (!props.editable || !selectionHasEditableCells()) return;
|
||||
bulkEditValue.value = "";
|
||||
@@ -8989,10 +8994,19 @@ const gridContextMenuItems = computed<ContextMenuItem[]>(() => {
|
||||
}
|
||||
|
||||
if (props.editable && hasCellSelection.value) {
|
||||
const hasEditableSelection = selectionHasEditableCells();
|
||||
if (!contextHeaderColumn.value) {
|
||||
items.push({
|
||||
label: t("grid.setNull"),
|
||||
action: setSelectionNull,
|
||||
disabled: !hasEditableSelection,
|
||||
icon: X,
|
||||
});
|
||||
}
|
||||
items.push({
|
||||
label: t("grid.bulkEditSelection"),
|
||||
action: openBulkEditDialog,
|
||||
disabled: !selectionHasEditableCells(),
|
||||
disabled: !hasEditableSelection,
|
||||
icon: Pencil,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -299,6 +299,8 @@ export function useDataGridEditor(options: UseDataGridEditorOptions) {
|
||||
}
|
||||
|
||||
function touchPendingChanges() {
|
||||
// Save errors describe the previous pending snapshot; edits, undo/redo, and rollback make them stale.
|
||||
saveError.value = "";
|
||||
pendingChangesVersion.value++;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user