From 43c75ec072ece2d150ffb3a8a211bfc946785ad3 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 6 Nov 2018 09:42:17 -0500 Subject: [PATCH] LP#1797007 Grid cell tooltips apply to all cells (Ang) Avoid excessive browser page re-flows, caused by checking cell widths for rendering tooltips, by rendering tooltips for all cells regardless of the size of the content. Signed-off-by: Bill Erickson Signed-off-by: Jason Boyer Signed-off-by: Galen Charlton --- .../share/grid/grid-body-cell.component.html | 4 +-- .../share/grid/grid-body-cell.component.ts | 36 ++----------------- 2 files changed, 4 insertions(+), 36 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/share/grid/grid-body-cell.component.html b/Open-ILS/src/eg2/src/app/share/grid/grid-body-cell.component.html index 3de90e41aa..578bef5e9c 100644 --- a/Open-ILS/src/eg2/src/app/share/grid/grid-body-cell.component.html +++ b/Open-ILS/src/eg2/src/app/share/grid/grid-body-cell.component.html @@ -1,6 +1,6 @@ @@ -8,7 +8,7 @@ ; constructor( private elm: ElementRef ) {} ngOnInit() {} - - ngAfterContentChecked() { - this.setTooltip(); - } - - // Returns true if the contents of this cell exceed the - // boundaries of its container. - cellOverflows(): boolean { - let node = this.elm.nativeElement; - if (node) { - node = node.parentNode; - return node && ( - node.scrollHeight > node.clientHeight || - node.scrollWidth > node.clientWidth - ); - } - return false; - } - - // Tooltips are only applied to cells whose contents exceed - // their container. - // Applying an empty string value prevents a tooltip from rendering. - setTooltip() { - if (this.cellOverflows()) { - this.tooltipContent = this.column.cellTemplate || - this.context.getRowColumnValue(this.row, this.column); - } else { - // No tooltip - this.tooltipContent = ''; - } - } } -- 2.43.2