ClassicTable

Introduction

ClassicTable is a widget in Supervisely that is used for displaying and manipulating data in a table format. It is similar to the Table widget but with fewer customization options and functionalities.

Note, that this is a legacy version. It is recommended to use the newer Table widget instead.

Function signature

classic_table = ClassicTable()
classic_table.read_pandas(pd.DataFrame(data=data, index=b, columns=a))

or

classic_table = ClassicTable(
    data=pd.DataFrame(data=data, index=b, columns=a),
    fixed_columns_num=1,
    widget_id=None
)

Parameters

Parameters
Type
Description

data

pd.DataFrame() or dict

Data of table

columns

list

List of columns names

fixed_columns_num

int

Number of fixed columns (left to right)

widget_id

str

ID of the widget

data

Data of table in different formats:

  1. Pandas Dataframe:

  1. Python dict with structure:

columns

List of columns names.

type: list

default value: None

fixed_columns_num

Number of fixed colums (left to right).

type: int

default value: None

widget_id

ID of the widget.

type: str

default value: None

Methods and attributes

Attributes and Methods
Description

fixed_columns_num

Get or set number of fixed columns (left to right) property.

to_json()

Convert table data to json.

to_pandas()

Convert table data to pandas dataframe.

read_json(value: dict)

Read and set table data from json.

read_pandas(value: pd.DataFrame)

Read and set table data from pandas dataframe.

insert_row(index=-1)

Insert new row in table.

pop_row(value: pd.DataFrame)

Remove row from table by index.

get_selected_cell(state)

Get selected table cell info.

Mini App Example

You can find this example in our Github repository:

ui-widgets-demos/tables/002_classic_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 ClassicTable widget

or 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.

Last updated

Was this helpful?