Skip to content

Instantly share code, notes, and snippets.

@re4388
Last active September 14, 2022 07:13
Show Gist options
  • Save re4388/d400347d7f8f70db6c9974af54730f39 to your computer and use it in GitHub Desktop.
Save re4388/d400347d7f8f70db6c9974af54730f39 to your computer and use it in GitHub Desktop.
work-snippet1
public setSelectedRow(
event: MouseEvent | KeyboardEvent,
rowTag: string,
// turnOffEditable: boolean = true
): void {
// 1. unselected if select again (this.selectedRow === rowTag)
this.selectedRow = this.selectedRow === rowTag ? null : rowTag;
// 2. refer to dicomEditModalShortcut component
this.selectedElement$.next(<HTMLElement>event.currentTarget);
// 3. turn off the the edit cell when select the row
this.editableCell = null;
// remove part:
// if (turnOffEditable) {
// this.editableCell = null;
// console.log("this.editableCell in setSelectedRow", this.editableCell);
// }
}
public setEditableCell(event: MouseEvent | KeyboardEvent, cellTag: string): void {
event.stopImmediatePropagation();
// remove part:
// const turnOffEditable: boolean =
// this.displayDimension.group === TagGroup.NonModifiable ||
// this.editableCell === cellTag;
// 1. no edit for NonModifiable group
if (this.displayDimension.group === TagGroup.NonModifiable) return
// 2. we need to select the edit row first
if (this.selectedRow !== cellTag) {
this.setSelectedRow(event, cellTag);
}
// 3. mark it edit
this.editableCell = cellTag;
// remove part:
// // make cell editable
// if (!turnOffEditable) {
// this.editableCell = cellTag;
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment