Skip to content

Commit ef1d267

Browse files
committed
Use simpler examples
1 parent 7e84a64 commit ef1d267

File tree

4 files changed

+20
-14
lines changed

4 files changed

+20
-14
lines changed

docs/options/options.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ ITables is a wrapper for the Javascript DataTables library, which means that you
2020

2121
Since ITables just maps these options to DataTables, you are invited to have a look at DataTable's great [documentation](https://datatables.net/), and to its huge collection of [examples](https://datatables.net/examples/index). The DataTable [forum](https://datatables.net/forums/) can be quite useful as well.
2222

23-
A non-exhaustive list of the DataTable options, together with their expected types, is available at [`itables.typing.DataTableOptions`](https://github.com/mwouts/itables/blob/main/src/itables/typing.py). If you see an option that you find useful, please make a PR (and add an example to the documentation, too).
23+
A non-exhaustive list of the DataTable options, together with their expected types, is available at [`itables.typing.DataTableOptions`](https://github.com/mwouts/itables/blob/main/src/itables/typing.py).
24+
25+
Option names and types are checked by default at run time when `typeguard>=4.4.1` is installed - you can deactivate this by setting `warn_on_undocumented_option=False`.
26+
27+
If you see an option that you find useful and is not documented, or a type hint that is incorrect, please make a PR (and add an example to the documentation, too).
2428

2529
```{code-cell} ipython3
2630
:tags: [scroll-output]

docs/options/order.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ kernelspec:
1414

1515
# Order
1616

17-
Since `itables>=1.3.0`, the interactive datatable shows the rows in the same order as the original dataframe:
17+
Since ITables v1.3.0, the interactive datatable shows the rows in the same order as the original dataframe.
18+
19+
You can pre-select a explicit order with the [`order`](https://datatables.net/reference/option/order) option:
1820

1921
```{code-cell} ipython3
2022
import pandas as pd
@@ -23,14 +25,6 @@ import itables
2325
2426
itables.init_notebook_mode()
2527
26-
for name, test_df in itables.sample_dfs.get_dict_of_test_dfs().items():
27-
if "sorted" in name:
28-
itables.show(test_df, caption=name.replace("_", " ").title())
29-
```
30-
31-
You can also set an explicit [`order`](https://datatables.net/reference/option/order) argument:
32-
33-
```{code-cell} ipython3
3428
sorted_df = pd.DataFrame({"i": [1, 2], "a": [2, 1]}).set_index(["i"])
3529
itables.show(sorted_df, order=[[1, "asc"]])
3630
```

docs/options/scroll_x.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ kernelspec:
1414

1515
# Horizontal Scroll
1616

17-
Since ITables 2.1.2, the `.dt-layout-table` div has a default overflow equal to `auto`, so in most cases you don't need to use the [`scrollX`](https://datatables.net/reference/option/scrollX) option of datatables.
17+
DataTables has a [`scrollX`](https://datatables.net/reference/option/scrollX) option that might be helpful for wide tables.
18+
19+
```{tip}
20+
Since ITables v2.1.2, the `.dt-layout-table` div has a default overflow equal to `auto`, so in most cases you don't need to use `scrollX`.
21+
```
1822

1923
```{code-cell} ipython3
2024
:tags: [full-width]
@@ -23,6 +27,10 @@ import itables
2327
2428
itables.init_notebook_mode()
2529
26-
df = itables.sample_dfs.get_countries(html=False)
30+
df = itables.sample_dfs.get_dict_of_test_dfs()["wide"]
2731
itables.show(df, scrollX=True)
2832
```
33+
34+
```{warning}
35+
Using `scrollX` on a table that is not wide enough can lead to an issue where the table headers are not aligned with the table content.
36+
```

docs/options/scroll_y.md

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

1515
# Vertical Scroll
1616

17-
You can replace the pagination with a [vertical scroll](https://datatables.net/examples/basic_init/scroll_y.html):
17+
The [`scrollY`](https://datatables.net/examples/basic_init/scroll_y.html) parameter is an interesting alternative to the pagination:
1818

1919
```{code-cell} ipython3
2020
:tags: [full-width]
@@ -24,5 +24,5 @@ import itables
2424
itables.init_notebook_mode()
2525
2626
df = itables.sample_dfs.get_countries(html=False)
27-
itables.show(df, scrollY="200px", scrollCollapse=True, paging=False)
27+
itables.show(df, scrollY="350px", scrollCollapse=True, paging=False)
2828
```

0 commit comments

Comments
 (0)