Skip to content

Commit

Permalink
Adjust docs on custom tables
Browse files Browse the repository at this point in the history
  • Loading branch information
maxschulz-COL committed Feb 21, 2024
1 parent 81da772 commit 0418eea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 7 additions & 5 deletions vizro-core/docs/pages/user-guides/custom-tables.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# How to create custom tables
# How to create custom Dash Datatables and Dash AGGrids

If you want to use the [`Table`][vizro.models.Table] model to and to create a custom [table](table.md) you can create your own custom table, e.g. when requiring computations that can be controlled by parameters.
In case that the available arguments for the [`Table`][vizro.models.Table] or [`AGGrid`][vizro.models.AGGrid] models are not sufficient,
there is always the possibility to create a custom Dash DataTable or Dash AGGrid.

One reason could be that you want to create a table/grid that requires computations that can be controlled by parameters (see below example).

For this, similar to how one would create a [custom chart](../user-guides/custom-charts.md), simply do the following:

- define a function that returns a `dash_table.DataTable` object
- decorate it with the `@capture("table")` decorator
- define a function that returns a `dash_table.DataTable` or `dash_ag_grid.AgGrid` object
- decorate it with the `@capture("table")` or `@capture("grid")` decorator respectively
- the function must accept a `data_frame` argument (of type `pandas.DataFrame`)
- the table should be derived from and require only one `pandas.DataFrame` (e.g. any further dataframes added through other arguments will not react to dashboard components such as `Filter`)


The following example shows a possible version of a custom table. In this case the argument `chosen_columns` was added, which you can control with a parameter:

??? example "Custom Dash DataTable"
Expand Down
2 changes: 1 addition & 1 deletion vizro-core/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ nav:
- Integrations: pages/user-guides/integration.md
- EXTENSIONS:
- Custom Charts: pages/user-guides/custom-charts.md
- Custom Tables: pages/user-guides/custom-tables.md
- Custom AGGrids/Tables: pages/user-guides/custom-tables.md
- Custom Components: pages/user-guides/custom-components.md
- Custom Actions: pages/user-guides/custom-actions.md
- API Reference:
Expand Down

0 comments on commit 0418eea

Please sign in to comment.