Skip to content

Commit

Permalink
Fix issue with tfoot
Browse files Browse the repository at this point in the history
Prior to this, the table footer would go outside of the table when exporting the notebook to HTML
  • Loading branch information
mwouts committed Nov 2, 2024
1 parent 57cf995 commit f9ce618
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 15 deletions.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ITables ChangeLog
------------------

**Fixed**
- Table footers continue to work when the notebook is exported to HTML ([#331](https://github.com/mwouts/itables/issues/331))
- The dependencies of the Streamlit component have been updated ([#327](https://github.com/mwouts/itables/pull/327), [#330](https://github.com/mwouts/itables/pull/330))

**Added**
Expand Down
11 changes: 5 additions & 6 deletions src/itables/html/column_filters/pre_dt_code.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Setup - add a text input to each header or footer cell
$('#table_id:not(.dataTable) thead_or_tfoot th').each(function () {
let title = $(this).text();
$(this).html('<input type="text" placeholder="Search ' +
// We use encodeURI to avoid this LGTM error:
// https://lgtm.com/rules/1511866576920/
encodeURI(title).replaceAll("%20", " ") +
'" />');
var input = document.createElement("input");
input.type = "text";
input.placeholder = "Search " + $(this).text();

$(this).html(input);
});
10 changes: 2 additions & 8 deletions src/itables/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,7 @@


try:
import google.colab

# I can't find out how to suppress the LGTM alert about unused-import
# (Tried with # lgtm[py/unused-import] # noqa: F401)
# So we use the import:
assert google.colab.output
import google.colab # noqa: F401

GOOGLE_COLAB = True
except ImportError:
Expand Down Expand Up @@ -200,8 +195,7 @@ def _table_header(
footer = ""

return """<table id="{table_id}" class="{classes}" data-quarto-disable-processing="true" {style}>
{tags}{header}<tbody>{tbody}</tbody>
{footer}
{tags}{header}{footer}<tbody>{tbody}</tbody>
</table>""".format(
table_id=table_id,
classes=classes,
Expand Down
2 changes: 1 addition & 1 deletion src/itables/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""ITables' version number"""

__version__ = "2.2.3-dev"
__version__ = "2.2.3"

0 comments on commit f9ce618

Please sign in to comment.