Table
Introduction
Table
widget in Supervisely allows for displaying and manipulating data in a table format.
It supports data in the Pandas DataFrame format or a Python dictionary with a specific structure.
The Table
widget allows searching, sorting by column and direction, and the ability to download or customize data before downloading. It also allows for the creation of buttons in table cells and updating table data in real-time through Python code.
Function signature
or
Parameters
Parameters | Type | Description |
---|---|---|
|
| Data of table |
|
| List of columns names |
|
| Number of fixed columns (left to right) |
|
| Default per page value |
|
| Page sizes presets |
|
| Width of table |
|
| Column ID by which the table will be sorted |
|
| Table sorting direction |
|
| ID of the widget |
data
Data of table in different formats:
Pandas Dataframe:
Python dict with structure:
columns
List of columns names.
type: Optional[list]
default value: None
fixed_cols
Number of fixed colums (left to right).
type: Optional[int]
default value: None
per_page
Default per page value.
type: Optional[int]
default value: 10
page_sizes
Page sizes presets.
type: Optional[List[int]]
default value: [10, 15, 30, 50, 100]
width
Width of table.
type: Optional[str]
default value: auto
sort_column_id
Column ID by which the table will be sorted.
type: int
default value: 0
sort_direction
Table sorting direction.
type: Optional[Literal["asc", "desc"]]
default value: asc
widget_id
ID of the widget.
type: str
default value: None
Methods and attributes
Attributes and Methods | Description |
---|---|
| Get or set number of fixed columns (left to right) property. |
| Get or set summary row data property. |
| Convert table data to JSON format. |
| Convert table data to pandas |
| Read and set table data from JSON format. |
| Read and set table data from pandas |
| Insert new row in table by index. |
| Remove row from table by index. |
| Get selected table cell info. |
| Static method to get HTML code for button with given title. |
| Static method to get HTML code for button with given title. |
| Get or set table loading status property. |
| Deselect a table cell. |
| Delete row by column name and cell value. |
| Update single cell value by column name and cell value. |
| Update all matching cells values by column name and cell value. |
| Sort table rows by given column ID and/or order direction. |
| Decorator function is handled when "download as csv" button is pressed. |
| Decorator function is handled when table cell is pressed. |
Mini App Example
You can find this example in our Github repository:
ui-widgets-demos/tables/001_table/src/main.py
Import libraries
Init API client
First, we load environment variables with credentials and init API for communicating with Supervisely Instance:
Prepare function that creates example pandas table
Create data for table.
Initialize Table
widget
Table
widgetor you can initialize empty table and set data later.
Create app layout
Prepare a layout for app using Card
widget with the content
parameter and place widget that we've just created in the Container
widget.
Create app using layout
Create an app object with layout parameter.
Add functions to control widget from python code
Last updated