Transfer

Introduction

The Transfer widget in Supervisely is a user interface element that allows users to transfer items between two lists. The Transfer widget is useful for creating project dashboards that require users to transfer items between two lists quickly and easily. Users can customize the appearance and behavior of the Transfer widget to match their project requirements, such as adding filterable options and customizing the names of the lists, buttons, and more. Overall, the Transfer widget is a simple tool to select needed or remove unnecessary items from the list. The Transfer widget has event handlers that are triggered when items in the right lists are changed. This can be useful for applications that require dynamic change handling, such as showing data from the selected items.

Function signature

Transfer(
    items=None, transferred_items=None,
    filterable=False, filter_placeholder=None,
    titles=None, button_texts=None,
    left_checked=None, right_checked=None,
    widget_id=None
)
default

Parameters

Parameters
Type
Description

items

Union[List[Item], List[str]]

List of Transfer.Item widgets or list of strings

transferred_items

List[str]

List of strings, containing keys from items

filterable

bool

Whether Transfer is filterable

filter_placeholder

str

Placeholder for filter if filterable=True

titles

List[str

List of titles for left and right lists

button_texts

List[str

List of button texts for left and right lists

left_checked

List[str

List of checked items for left list

right_checked

List[str

List of checked items for right list

widget_id

str

ID of the widget

items

Determine the list of Transfer.Item widgets or list of strings, containing keys for items, from which Transfer.Item widgets will be created.

type: Union[List[Item], List[str]]

default value: None

Prepare transfer items:

Initialize widget with given items:

items

transferred_items

Determine the list of strings, containing keys for items, that will be shown in the right list. Note: transferred_items should be a subset of keys of items, otherwise the error will be raised.

type: List[str]

default value: None

Initialize widget with transferred items:

transferred_items

filterable

Determine whether the Transfer is filterable or not.

type: bool

default value: False

Initialize widget with filterable option:

filterable

filter_placeholder

Determine the placeholder for the filter field if filterable=True.

type: str

default value: None

Initialize widget with filter placeholder:

filter_placeholder

titles

Determine the list of titles for left and right lists.

type: List[str]

default value: None

Initialize widget with titles:

titles

button_texts

Determine the list of texts for each button.

type: List[str]

default value: None

Initialize widget with button texts:

button_texts

left_checked

Determine the list of items that will be checked in the left list when the widget is initialized.

type: List[str]

default value: None

Initialize widget with checked items:

left_checked

right_checked

Determine the list of items that will be checked in the right list when the widget is initialized.

type: List[str]

default value: None

Initialize widget with checked items:

right_checked

widget_id

The ID of the widget.

type: str

default value: None

Initialize widget with ID:

Methods and attributes

Methods and attributes
Description

get_transferred_items()

Get the list of keys of items in the right list

get_untransferred_items()

Get the list of keys of items in the left list

@value_changed

Event that is triggered when items in the right list changed

set_items(items: Union[List[Transfer.Item], List[str]])

Set the items list (replacing it) for the widget

set_transferred_items(transferred_items: List[str])

Set the transferred items list (replacing it) for the widget

add(items: Union[List[Item], List[str]]):

Adds new items to the widget

remove(items_keys: List[str])

Remove items from the widget by key

get_items_keys()

Get the list of keys of items in the widget

Mini app example

You can find this example in our GitHub repository:

supervisely-ecosystem/ui-widgets-demos/selection/010_transfer/src/main.py

Import libraries

Init API client

First, we load environment variables with credentials and init API for communicating with Supervisely Instance:

Prepare items for Transfer widget

Initialize Transfer widget

Changing the list of transferred items

Removing an item and getting keys of items (all, transferred, untransferred)

Using @value_changed event

Create app layout

Prepare a layout for the app using Card widget with the content parameter and place widget that we've just created in the Container widget.

Create an app using the layout

Create an app object with the layout parameter.

mini_app

Last updated

Was this helpful?