Skip to content

Commit f9ce618

Browse files
committed
Fix issue with tfoot
Prior to this, the table footer would go outside of the table when exporting the notebook to HTML
1 parent 57cf995 commit f9ce618

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

docs/changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ITables ChangeLog
55
------------------
66

77
**Fixed**
8+
- Table footers continue to work when the notebook is exported to HTML ([#331](https://github.com/mwouts/itables/issues/331))
89
- 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))
910

1011
**Added**
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// Setup - add a text input to each header or footer cell
22
$('#table_id:not(.dataTable) thead_or_tfoot th').each(function () {
3-
let title = $(this).text();
4-
$(this).html('<input type="text" placeholder="Search ' +
5-
// We use encodeURI to avoid this LGTM error:
6-
// https://lgtm.com/rules/1511866576920/
7-
encodeURI(title).replaceAll("%20", " ") +
8-
'" />');
3+
var input = document.createElement("input");
4+
input.type = "text";
5+
input.placeholder = "Search " + $(this).text();
6+
7+
$(this).html(input);
98
});

src/itables/javascript.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,7 @@
6060

6161

6262
try:
63-
import google.colab
64-
65-
# I can't find out how to suppress the LGTM alert about unused-import
66-
# (Tried with # lgtm[py/unused-import] # noqa: F401)
67-
# So we use the import:
68-
assert google.colab.output
63+
import google.colab # noqa: F401
6964

7065
GOOGLE_COLAB = True
7166
except ImportError:
@@ -200,8 +195,7 @@ def _table_header(
200195
footer = ""
201196

202197
return """<table id="{table_id}" class="{classes}" data-quarto-disable-processing="true" {style}>
203-
{tags}{header}<tbody>{tbody}</tbody>
204-
{footer}
198+
{tags}{header}{footer}<tbody>{tbody}</tbody>
205199
</table>""".format(
206200
table_id=table_id,
207201
classes=classes,

src/itables/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""ITables' version number"""
22

3-
__version__ = "2.2.3-dev"
3+
__version__ = "2.2.3"

0 commit comments

Comments
 (0)