table class
Displays a data set as tabular data.
Methods¶
__init__() ¶
__init__(
data=None,
page_size=100,
allow_all_rows=False,
show_all=False,
auto_loading=False,
selected=None,
page_size_options=[50, 100, 500],
columns=None, # All columns
date_format="MM/dd/yyyy",
number_format=None,
row_class_name=None,
tooltip=None,
width="100%",
height="80vh",
filter=False,
nan_value="",
editable=False,
on_edit=None, # default implementation
on_add=None,
on_delete=None, # default implementation
on_action=None,
size="small",
rebuild=False,
downloadable=False,
on_compare=None,
use_checkbox=False,
sortable=True,
active=True,
id=None,
properties=None,
class_name=None,
hover_text=None,
) -> None
Create a new table element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
dynamic(Any)
|
The data to be represented in this table. This property can be indexed to define other data for comparison. |
None
|
page_size
|
int
|
For a paginated table, the number of visible rows. |
100
|
allow_all_rows
|
bool
|
For a paginated table, adds an option to show all the rows. |
False
|
show_all
|
bool
|
For a paginated table, show all the rows. |
False
|
auto_loading
|
bool
|
If True, the data will be loaded on demand. |
False
|
selected
|
dynamic(Union[list[int], str])
|
The list of the indices of the rows to be displayed as selected. |
None
|
page_size_options
|
Union[list[int], str]
|
The list of available page sizes that users can choose from. |
[50, 100, 500]
|
columns
|
Union[str, list[str], dict[str, dict[str, Union[str, int]]]]
|
The list of the column names to display.
If columns is omitted or set to None, all columns of data are represented. |
All columns
|
date_format
|
str
|
The date format used for all date columns when the format is not specifically defined. |
MM/dd/yyyy
|
number_format
|
str
|
The number format used for all number columns when the format is not specifically defined. |
None
|
row_class_name
|
Union[str, Callable]
|
Allows for styling rows.
See below for more details. |
None
|
tooltip
|
Union[str, Callable]
|
Enables tooltips on cells. |
None
|
width
|
str
|
The width of the table control, in CSS units. |
100%
|
height
|
str
|
The height of the table control, in CSS units. |
80vh
|
filter
|
bool
|
Indicates, if True, that all columns can be filtered. |
False
|
nan_value
|
str
|
The replacement text for NaN (not-a-number) values. |
|
editable
|
dynamic(bool)
|
Indicates, if True, that all cells can be edited. |
False
|
on_edit
|
Union[bool, Callable]
|
A function or the name of a function triggered when an edited cell is validated.
If this property is not set, the table will use the default implementation for editing cells. |
default implementation
|
on_add
|
Union[bool, Callable]
|
A function or the name of a function that is triggered when the user requests a row to be added to the table.
If this property is not set, the table uses the default implementation for adding a new row If this property is set to False, you cannot add new rows. |
None
|
on_delete
|
Union[bool, Callable]
|
A function or the name of a function triggered when a row is deleted.
If this property is not set, the table uses the default implementation for deleting rows. |
default implementation
|
on_action
|
Union[str, Callable]
|
A function or the name of a function that is triggered when the user selects a row.
|
None
|
size
|
str
|
The size of the rows. |
small
|
rebuild
|
dynamic(bool)
|
If set to True, this allows to dynamically refresh the columns. |
False
|
downloadable
|
bool
|
If True, a clickable icon is shown so the user can download the data as CSV. |
False
|
on_compare
|
Union[str, Callable]
|
A function or the name of a function that compares data. This function should return a structure that identifies the differences between the different data passed as name. The default implementation compares the default data with the data[1] value. |
None
|
use_checkbox
|
bool
|
If True, boolean values are rendered as a simple HTML checkbox. |
False
|
sortable
|
bool
|
If False, the table provides no sorting capability. Individual columns can override this global setting, allowing specific columns to be marked as sortable or non-sortable regardless of value of sortable, by setting the sortable property to True or False accordingly, in the dictionary for that column in the columns property value. |
True
|
active
|
dynamic(bool)
|
Indicates if this element is active. |
True
|
id
|
str
|
The identifier assigned to the rendered HTML component. |
None
|
properties
|
dict[str, Any]
|
A dictionary of additional properties that can be set to the element. |
None
|
class_name
|
dynamic(str)
|
A space-separated list of CSS class names to be applied to the generated HTML element. |
None
|
hover_text
|
dynamic(str)
|
The text that is displayed when the user hovers over the element. |
None
|