diff --git a/src/myfasthtml/assets/myfasthtml.js b/src/myfasthtml/assets/myfasthtml.js index 51866a6..75cea03 100644 --- a/src/myfasthtml/assets/myfasthtml.js +++ b/src/myfasthtml/assets/myfasthtml.js @@ -190,7 +190,7 @@ function bindTooltipsWithDelegation(elementId) { // Add a single mouseenter and mouseleave listener to the parent element element.addEventListener("mouseenter", (event) => { - // OPTIMIZATION C: Early exit - check mf-no-tooltip FIRST (before any DOM work) + // Early exit - check mf-no-tooltip FIRST (before any DOM work) if (element.hasAttribute("mf-no-tooltip")) { return; } @@ -243,14 +243,14 @@ function bindTooltipsWithDelegation(elementId) { } } }); - }); // OPTIMIZATION C: Removed capture phase (not needed) + }, true); // Capture phase required: mouseenter doesn't bubble element.addEventListener("mouseleave", (event) => { const cell = event.target.closest("[data-tooltip]"); if (cell) { tooltipContainer.setAttribute("data-visible", "false"); } - }); // OPTIMIZATION C: Removed capture phase (not needed) + }, true); // Capture phase required: mouseleave doesn't bubble } function initLayout(elementId) { diff --git a/src/myfasthtml/controls/DataGrid.py b/src/myfasthtml/controls/DataGrid.py index 3b9f16f..621ecf9 100644 --- a/src/myfasthtml/controls/DataGrid.py +++ b/src/myfasthtml/controls/DataGrid.py @@ -307,10 +307,12 @@ class DataGrid(MultipleInstance): if not col_def.visible: return OptimizedDiv(cls="dt2-col-hidden") + value = self._state.ns_fast_access[col_def.col_id][row_index] content = self.mk_body_cell_content(col_pos, row_index, col_def, filter_keyword_lower) return OptimizedDiv(content, data_col=col_def.col_id, + data_tooltip=str(value), style=f"width:{col_def.width}px;", cls="dt2-cell")