Fixed minor issues.

* highlighted cells not correctly rendered
* text selection not correctly working
This commit is contained in:
2026-03-15 18:45:55 +01:00
parent 0c9c8bc7fa
commit 0951680466
2 changed files with 4 additions and 4 deletions

View File

@@ -673,9 +673,9 @@ function updateDatagridSelection(datagridId) {
// Clear browser text selection to prevent stale ranges from reappearing // Clear browser text selection to prevent stale ranges from reappearing
// But skip if an input/textarea/contenteditable has focus (would clear text cursor) // But skip if an input/textarea/contenteditable has focus (would clear text cursor)
if (!document.activeElement?.closest('input, textarea, [contenteditable]')) { // if (!document.activeElement?.closest('input, textarea, [contenteditable]')) {
window.getSelection()?.removeAllRanges(); // window.getSelection()?.removeAllRanges();
} // }
// OPTIMIZATION: scope to table instead of scanning the entire document // OPTIMIZATION: scope to table instead of scanning the entire document
const table = document.getElementById(`t_${datagridId}`); const table = document.getElementById(`t_${datagridId}`);

View File

@@ -794,7 +794,7 @@ class DataGrid(MultipleInstance):
res.append(Span(value_str[:index], cls=f"{css_class}")) res.append(Span(value_str[:index], cls=f"{css_class}"))
res.append(Span(value_str[index:index + len_keyword], cls="dt2-highlight-1")) res.append(Span(value_str[index:index + len_keyword], cls="dt2-highlight-1"))
if index + len_keyword < len(value_str): if index + len_keyword < len(value_str):
res.append(Span(value_str[index + len_keyword:], cls=f"{css_class}")) res.append(Span(value_str[index + len_keyword:]))
return Span(*res, cls=f"{css_class} truncate", style=style) if len(res) > 1 else res[0] return Span(*res, cls=f"{css_class} truncate", style=style) if len(res) > 1 else res[0]