Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call new DataTable on tables only #318

Merged
merged 2 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
ITables ChangeLog
=================

2.2.2-dev (2024-09-??)
------------------

**Fixed**
- We have fixed a HTML pop up warning when displaying Pandas Style objects in Quarto ([#317](https://github.com/mwouts/itables/issues/317))
- The dependencies of the Streamlit component have been updated ([#323](https://github.com/mwouts/itables/pull/323))


2.2.1 (2024-09-22)
------------------

Expand Down
3 changes: 3 additions & 0 deletions src/itables/html/datatables_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
import {DataTable, jQuery as $} from 'https://www.unpkg.com/dt_for_itables/dt_bundle.js';

document.querySelectorAll("#table_id:not(.dataTable)").forEach(table => {
if (!(table instanceof HTMLTableElement))
return;

// Define the table data
const data = [];

Expand Down
16 changes: 7 additions & 9 deletions src/itables/javascript.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,19 +132,17 @@ def generate_init_offline_itables_html(dt_bundle: Path):
dt_css = dt_bundle.with_suffix(".css").read_text(encoding="utf-8")
dt64 = b64encode(dt_src.encode("utf-8")).decode("ascii")

id = "itables_init_notebook_mode_" + str(uuid.uuid4()).replace("-", "_")

return f"""<style>{dt_css}</style>
<div id="{id}" style="vertical-align:middle; text-align:left">
{get_animated_logo(opt.display_logo_when_loading)}<div>
This is the <code>init_notebook_mode</code> cell from ITables v{itables_version}<br>
(you should not see this message - is your notebook <it>trusted</it>?)
</div>
</div>
<div style="vertical-align:middle; text-align:left">
<script>
window.{DATATABLES_SRC_FOR_ITABLES} = "data:text/javascript;base64,{dt64}";
document.querySelectorAll("#{id}").forEach(e => e.remove());
</script>
<noscript>
{get_animated_logo(opt.display_logo_when_loading)}
This is the <code>init_notebook_mode</code> cell from ITables v{itables_version}<br>
(you should not see this message - is your notebook <it>trusted</it>?)
</noscript>
</div>
"""


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.1"
__version__ = "2.2.2-dev"
Loading