|
1 | 1 | # --- |
2 | 2 | # jupyter: |
3 | 3 | # jupytext: |
4 | | -# default_lexer: ipython3 |
5 | 4 | # formats: docs///md:myst,docs/py///py:percent |
6 | 5 | # notebook_metadata_filter: -jupytext.text_representation.jupytext_version |
7 | 6 | # text_representation: |
|
19 | 18 | # |
20 | 19 | # ## DataTable Options |
21 | 20 | # |
22 | | -# ITables is a wrapper for the Javascript DataTables library, which means that you can use more or less directly the DataTables [options](https://datatables.net/options) from within Python. |
| 21 | +# ITables is a wrapper for the JavaScript DataTables library, which means you can often use DataTables [options](https://datatables.net/options) directly within ITables. |
23 | 22 | # |
24 | | -# 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. |
| 23 | +# Since ITables simply maps these options to DataTables, we encourage you to consult DataTables’ excellent [documentation](https://datatables.net/) and its extensive collection of [examples](https://datatables.net/examples/index). The DataTables [forum](https://datatables.net/forums/) can also be quite helpful. |
25 | 24 | # |
26 | | -# 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). |
| 25 | +# A non-exhaustive list of DataTables options, along with their expected types, is provided by `DataTableOptions` in [`itables.typing`](https://github.com/mwouts/itables/blob/main/src/itables/typing.py). |
27 | 26 | # |
28 | | -# 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`. |
29 | | -# |
30 | | -# 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). |
31 | | - |
32 | | -# %% tags=["scroll-output"] |
33 | | -import inspect |
34 | | - |
35 | | -import itables |
36 | | - |
37 | | -print(inspect.getsource(itables.typing.DataTableOptions)) |
38 | | - |
39 | | -# %% [markdown] |
40 | 27 | # ## ITable Options |
41 | 28 | # |
42 | | -# ITables itself adds a few options like `connected`, `maxBytes`, `allow_html` etc. |
| 29 | +# ITables adds a few options of its own, such as `connected`, `maxBytes`, `allow_html`, and others. An exhaustive list of these additional options is provided by `ITableOptions` in [`itables.typing`](https://github.com/mwouts/itables/blob/main/src/itables/typing.py). |
43 | 30 | # |
44 | | -# The ITable options are documented at [`itables.typing.ITableOptions`](https://github.com/mwouts/itables/blob/main/src/itables/typing.py): |
45 | | - |
46 | | -# %% tags=["scroll-output"] |
47 | | -print(inspect.getsource(itables.typing.ITableOptions)) |
48 | | - |
49 | | -# %% [markdown] |
50 | | -# ## Default values |
| 31 | +# ## Default Values |
| 32 | +# |
| 33 | +# The default values for these options are set in [`itables.options`](https://github.com/mwouts/itables/blob/main/src/itables/options.py). These defaults are used in each call to `to_html_datatable`, `show`, or `ITable`, unless a corresponding option is set locally—in which case, the local value takes precedence. |
51 | 34 | # |
52 | | -# Some of the options have a default value set in [`itables.options`](https://github.com/mwouts/itables/blob/main/src/itables/options.py). You can change these defaults easily, and even set defauts for the options that don't have one yet with e.g. |
| 35 | +# ## Changing the Defaults |
| 36 | +# |
| 37 | +# You can change the default options in your notebook or application with: |
53 | 38 | # |
54 | 39 | # ```python |
55 | 40 | # import itables |
56 | 41 | # |
57 | 42 | # itables.options.maxBytes = "128KB" |
58 | 43 | # ``` |
59 | | - |
60 | | -# %% tags=["scroll-output"] |
61 | | -print(inspect.getsource(itables.options)) |
| 44 | +# |
| 45 | +# ## Configuration File |
| 46 | +# |
| 47 | +# Since v2.5.0, ITable can load its default options from a configuration file. The configuration file is identified using `get_config_file` from [`itables.config`](https://github.com/mwouts/itables/blob/main/src/itables/config.py). It can be: |
| 48 | +# |
| 49 | +# - The file pointed to by the environment variable `ITABLES_CONFIG`, if set and non-empty (if the variable is an empty string, no configuration file is used) |
| 50 | +# - An `itables.toml` file in the current or a parent directory |
| 51 | +# - A `tool.itables` section in a `pyproject.toml` file in the current or a parent directory |
| 52 | +# |
| 53 | +# A sample configuration file could look like this: |
| 54 | +# ``` |
| 55 | +# # itables.toml |
| 56 | +# classes = ["display", "nowrap", "compact"] |
| 57 | +# buttons = ["pageLength", "copyHtml5", "csvHtml5", "excelHtml5"] |
| 58 | +# ``` |
| 59 | +# |
| 60 | +# Add this to use the [column control](column_control.md) extension: |
| 61 | +# ``` |
| 62 | +# [[columnControl]] |
| 63 | +# target = 0 |
| 64 | +# content = ["order"] |
| 65 | +# [[columnControl]] |
| 66 | +# target = "tfoot" |
| 67 | +# content = ["search"] |
| 68 | +# |
| 69 | +# [ordering] |
| 70 | +# indicators = false |
| 71 | +# handler = false |
| 72 | +# ``` |
| 73 | +# |
| 74 | +# ## Option Names and Type Checks |
| 75 | +# |
| 76 | +# Option names and types are checked by default at runtime when `typeguard>=4.4.1` is installed. You can disable this by setting `warn_on_undocumented_option=False`. |
| 77 | +# |
| 78 | +# If you find an option that is useful but undocumented, or if you notice an incorrect type hint, please submit a PR (and consider adding an example to the documentation, too). |
0 commit comments