Skip to content

Commit 0ea9a9e

Browse files
committed
Bundle name is dt_for_itables
Remove documentation on ColReorder
1 parent 0e64e98 commit 0ea9a9e

File tree

12 files changed

+18
-55
lines changed

12 files changed

+18
-55
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ repos:
3232
rev: v1.14.5
3333
hooks:
3434
- id: jupytext
35-
exclude: dt_package/
35+
exclude: dt_for_itables/
3636
types: ["markdown"]
3737
args: ["--pipe", "isort {} --treat-comment-as-code '# %%' --profile black", "--pipe", "black", "--check", "ruff check {} --ignore E402"]
3838
additional_dependencies:

docs/custom_extensions.md

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,7 @@ kernelspec:
1414

1515
# Custom Extensions
1616

17-
## Connected mode
18-
19-
To use custom extensions in the connected mode, you just have to go to the
20-
[download](https://datatables.net/download/) page of DataTables,
21-
select jQuery, DataTable, and the desired extensions, and take a note of the script URL
22-
when using the _CDN_ download method.
23-
24-
Then, you pass this custom URL as either the `dt_url` argument of the
25-
`show` function, or you set it on `opt.dt_url`.
17+
## Internationalisation
2618

2719
```{code-cell}
2820
from itables import show
@@ -31,20 +23,6 @@ from itables.sample_dfs import get_countries
3123
df = get_countries(html=False)
3224
```
3325

34-
For instance, if you wish to use the [select](https://datatables.net/extensions/select/)
35-
extension in the connected mode, you just have to set `dt_url` according to
36-
the [download](https://datatables.net/download/) page of DataTables, that is:
37-
38-
```{code-cell}
39-
show(
40-
df,
41-
select=True,
42-
dt_url="https://cdn.datatables.net/v/dt/jq-3.7.0/dt-2.0.2/sl-2.0.0/datatables.min.js",
43-
)
44-
```
45-
46-
## Internationalisation
47-
4826
DataTables controls can use a different language than English. To
4927
display the table controls in another language, go to the [internationalisation](https://datatables.net/plug-ins/i18n/)
5028
plug-ins page and find the language URL, like e.g.
@@ -75,9 +53,9 @@ To use custom extensions in the offline mode, you will need
7553
to create a bundle of jQuery, DataTable, and the desired extensions.
7654

7755
To do so, make a copy of
78-
[`itables/dt_package`](https://github.com/mwouts/itables/tree/main/itables/dt_package):
56+
[`itables/dt_for_itables`](https://github.com/mwouts/itables/tree/main/itables/dt_for_itables):
7957
```bash
80-
$ ls itables/dt_package/
58+
$ ls itables/dt_for_itables/
8159
package.json package-lock.json README.md src.js
8260
```
8361

@@ -94,6 +72,7 @@ import pdfMake from 'pdfmake';
9472
import DataTable from 'datatables.net-dt';
9573
import 'datatables.net-dt/css/dataTables.dataTables.min.css';
9674

75+
import 'datatables.net-buttons-dt';
9776
import 'datatables.net-buttons/js/buttons.html5.mjs';
9877
import 'datatables.net-buttons/js/buttons.print.mjs';
9978
import 'datatables.net-buttons-dt/css/buttons.dataTables.min.css';

docs/extensions.md

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,14 @@ show(
127127
)
128128
```
129129

130-
## ColReorder
130+
## KeyTable
131131

132-
The [ColReorder](https://datatables.net/extensions/colreorder/) lets you re-order the columns:
132+
With the [KeyTable](https://datatables.net/extensions/keytable/) extension you can navigate in a table using the arrow keys:
133133

134134
```{code-cell}
135135
:tags: [full-width]
136136
137-
show(df, colReorder=True)
137+
show(df, keys=True)
138138
```
139139

140140
```{tip}
@@ -143,20 +143,10 @@ You can activate this option for all your tables with
143143
~~~python
144144
import itables.options as opt
145145
146-
opt.colReorder = True
146+
opt.keys = True
147147
~~~
148148
```
149149

150-
## KeyTable
151-
152-
With the [KeyTable](https://datatables.net/extensions/keytable/) extension you can navigate in a table using the arrow keys:
153-
154-
```{code-cell}
155-
:tags: [full-width]
156-
157-
show(df, keys=True)
158-
```
159-
160150
```{warning}
161151
The KeyTable extension works in Jupyter Book (try it here in the documentation) but not in JupyterLab.
162152
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

itables/html/datatables_template_connected.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<table id="table_id"><thead><tr><th>A</th></tr></thead></table>
2-
<link href="https://cdn.datatables.net/v/dt/jq-3.7.0/dt-2.0.2/datatables.min.css" rel="stylesheet">
2+
<link href="https://www.unpkg.com/dt_for_itables@2.0.1/dt_bundle.css" rel="stylesheet">
33
<script type="module">
4-
import 'https://cdn.datatables.net/v/dt/jq-3.7.0/dt-2.0.2/datatables.min.js';
4+
import {DataTable, jQuery as $} from 'https://www.unpkg.com/dt_for_itables@2.0.1/dt_bundle.js';
55

66
$(document).ready(function () {
77
document.querySelectorAll("#table_id:not(.dataTable)").forEach(table => {

itables/javascript.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,7 @@ def html_table_from_template(
589589
if connected:
590590
output = read_package_file("html/datatables_template_connected.html")
591591
assert dt_url.endswith(".js")
592-
template_url = (
593-
"https://cdn.datatables.net/v/dt/jq-3.7.0/dt-2.0.2/datatables.min.js"
594-
)
592+
template_url = "https://www.unpkg.com/[email protected]/dt_bundle.js"
595593
output = replace_value(output, template_url, dt_url)
596594
output = replace_value(
597595
output,

0 commit comments

Comments
 (0)